This example illustrates how to check properties using environment variable whether it is set or not. In this code, there are three properties; the first two are used to define source directory and destination directory. The source directory is 'src' and the destination directory is 'build'. The element <property environment="env"> is a path of jar file dependent on environment variables, and these are available only if you use <property environment="env"> before you import the property file. The following example shows how to check whether TOMCAT_HOME environment variable is set or not. If TOMCAT_HOME environment variable is set, then the output will display build successful... as given below.
build.xml
|
|
Output:

But if TOMCAT_HOME environment variable is not set, then the following
error message will be displayed.

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Check Properties
Post your Comment