Java Reference
In-Depth Information
5.
Click Environment Variables. In the System Variables list, check to
see whether there is variable named
JAVA_HOME
and that the value
points to your JDK distribution. If
JAVA_HOME
is not present, click
New. Set the variable name to
JAVA_HOME
and set the variable value
to
C:\Program Files\Java\jdk1.7.0
or the root of your
JDK 7 installation.
On OS X, environment variables are set up within the
.bash
profile file, which resides within the user home directory. To add
JAVA_HOME
, add a line such as the following to the
.bash
_
pro-
file
:
export JAVA_HOME=/Library/Java/
JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
Test that you can reach Ant, and that Ant can find your JDK in-
stallation. To test that the changes took effect, do the following:
6.
Open a command window or terminal.
7.
Type
ANT
.
If you receive the message
"Ant is not recognized as an internal
or external command"
, redo the first steps of setting up the
PATH
variable (the
first set of instructions). If you receive the message
"unable to locate
tools.jar"
, you need to create and/or update the
JAVA_HOME
path for your in-
stallation (the second set of instructions).
The message
"Buildfile: build.xml does not exist!"
means that
your setup is ready to be built using Ant. Congratulations!
Note
When changing environment variables in Microsoft Windows, it is necessary
to close previous command-line windows and reopen them because changes are only
applied to new command windows. To open a command window in Microsoft Win-
dows, click Start, type
CMD
, and press Enter.
Create
build.xml
at the root of your project and put the following bare-bones
Ant script as the contents of the
build.xml
file. This particular
build.xml
file
contains information that Ant will use to compile and test this recipe.