More Tutorials| Bioinformatics| Open Source| Photoshop| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Built In Properties 
 

In this section, you will learn how to access various system properties using ant.

 

Built In Properties

                         

This example illustrates how to access various system properties using Ant. Ant provides access to all system properties as if they had been defined using a <property> task. Here is a list of the properties with descriptions.

 

 

 

 

 

Property

Description

basedir 

the absolute path of the project's basedir (as set with the basedir attribute of <project>).

ant.file

the absolute path of the buildfile.

ant.version 

the version of Ant

ant.project.name

the name of the project that is currently executing; it is set in the name attribute of <project>.

ant.java.version

the JVM version Ant detected; currently it can hold the values "1.2", "1.3", "1.4" and "1.5".

ant.home

home directory of Ant

java.version

JRE version

java.vendor

JRE vendor

java.vendor.url 

Java vendor URL

java.home

Java installation directory

java.vm.specification.version

JVM specification version

java.vm.specification.vendor

JVM specification vendor

java.vm.specification.name

JVM specification name

java.vm.version

JVM implementation version

java.vm.vendor 

JVM implementation vendor

java.vm.name 

JVM implementation name

java.specification.version

JRE specification version

java.specification.vendor

JRE specification vendor

java.specification.name

JRE specification name

java.class.version

Java class format version number

java.class.path

Java class path

java.ext.dirs

Path of extension directory or directories

os.name

Operating system name

os.arch 

Operating system architecture

os.version

Operating system version

file.separator

File separator ("/" on UNIX)

path.separator

Path separator (":" on UNIX)

line.separator

Line separator ("\n" on UNIX)

user.name

User's account name

user.home

User's home directory

user.dir

User's current working directory

 

The source code of build.xml file

<project name="Built-In-Properties" default="echo" basedir=".">
<property environment="env"/>
<target name="echo">
  <echo message="basedir : ${basedir}"/>

  <echo message="ant.file : ${ant.file}"/>
  <echo message="ant.project.name : ${ant.project.name}"/>
  <echo message="ant.home : ${ant.home}"/>
  <echo message="ant.version : ${ant.version}"/> 
    <echo message="ant.java.version : ${ant.java.version}"/>

  <echo message="java.version : ${java.version}"/>
  <echo message="java.vendor : ${java.vendor}"/>
  <echo message="java.vendor.url : ${java.vendor.url}"/>
  <echo message="java.home : ${java.home}"/>
    <echo message="java.vm.specification.version : ${java.vm.specification.version}"/>
  <echo message="java.vm.specification.vendor : ${java.vm.specification.vendor}"/>
  <echo message="java.vm.specification.name : ${java.vm.specification.name}"/>
  <echo message="java.vm.version : ${java.vm.version}"/>
  <echo message="java.vm.vendor : ${java.vm.vendor}"/>
    <echo message="java.vm.name : ${java.vm.name}"/>
  <echo message="java.specification.version : ${java.specification.version}"/>
  <echo message="java.specification.vendor : ${java.specification.vendor}"/>
  <echo message="java.specification.name : ${java.specification.name}"/>
  <echo message="java.class.version : ${java.class.version}"/>
    <echo message="java.class.path : ${java.class.path}"/>
  <echo message="java.ext.dirs : ${java.ext.dirs}"/>

  <echo message="os.name : ${os.name}"/>  
  <echo message="os.arch : ${os.arch}"/>
  <echo message="os.version : ${os.version}"/>

  <echo message="file.separator : ${file.separator}"/>
    <echo message="path.separator : ${path.separator}"/>
  <echo message="line.separator : ${line.separator}"/>  

  <echo message="user.home : ${user.home}"/>
  <echo message="user.name : ${user.name}"/>
  <echo message="user.dir : ${user.dir}"/>

  <echo message="Path: ${env.Path}"/>
  <echo message="Hostname: ${env.COMPUTERNAME}"/>
  </target>

</project>


 Run this code – the following output will be displayed.


Download Source Code

                         

» View all related tutorials
Related Tags: sql c database xml file url data ui build property user sed password word driver vi name using this element

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.