Build/Test tools| DBUNIT| ANT| Maven| JUNIT| Jmeter| Questions? | Software Development
 

Ant built-in Properties

In this section, you will learn how to how to find the basedir name, and file name etc.

Ant built-in Properties

                         

This is a simple example that illustrates how to find the basedir name, file name, project name, ant version, java version, operating system name, ant home directory name, java home directory name, user home directory name and user name. Ant provides you with certain built-in properties that you may find useful during your build process. The following table shows the property name and it's description.

Ant's built-in properties:

Property

Description

ant.file

The absolute path of the build file

ant.project.name

The name of the project as set in the <project> element's name attribute. 

ant.home

The root directory of ant

ant.version

The version of this ant installation. This is not just the version number and includes information such as the compilation date. 

ant.java.version

The version of the java that ant uses

basedir

The absolute path of the project

os.name

Operating system name

java.home

Java home directory name

user.home

User directory name

user.name

User name

 Source code of build.xml:

<?xml version="1.0"?>

<project name="AntProperties" default="echo" basedir=".">

  <target name="echo">
  <echo message="The operating system is: ${os.name}"/>  

  <!-- absolute path of the project. -->
  <echo message="The home path is: ${basedir}"/>

  <!-- absolute path of the build file. -->
  <echo message="The file name is: ${ant.file}"/>

  <!-- root directory of ant. -->
  <echo message="The Project name is: ${ant.project.name}"/>
  <echo message="The Ant home directory is: ${ant.home}"/>
  <echo message="The Ant version is: ${ant.version}"/> 
  <echo message="The Java version is: ${ant.java.version}"/>
  
  <!-- System properties. -->
  <echo message="The Java home directory is: ${java.home}"/>
  <echo message="The User home directory is: ${user.home}"/>
  <echo message="The User name is: ${user.name}"/>
  </target>

</project>

Run this program - the following output will be displayed:


Download Source Code

                         

» View all related tutorials
Related Tags: windows c string mac unix com file ide orm ant ui form build path jvm directory sed type window char

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 
 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
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

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

Copyright © 2008. All rights reserved.