Java Reference
In-Depth Information
When we wrote the examples for this topic, we used Ant from the Jakarta imple-
mentation provided by Apache Organization to provide build capabilities. Ant is
an open source tool for automating build processes.
This appendix is not a discussion of the advantages of Ant; it is a no-nonsense
guide to configuring and using it to build the topic's examples. For more infor-
mation about Ant—its usefulness, complete capabilities, and so forth—please
find it at http://www.manning.com/hatcher).
B.1 Downloading and installing Ant
This topic uses Ant version 1.4.1, downloadable from the Apache Organization
web site, under the Jakarta project area. From this web site, you can download
the documentation and installation executables. You can find out more about
Ant at http://jakarta.apacke.org/ant/index.html.
v1.4.1/bin directory. Choose the packaging you require for either the Unix or
Windows distribution. We developed the examples on Windows, so we chose the
v1.4.1/bin/jakarta-ant-1.4.1-bin.zip file.
Extract the zip file to a location of your choice and add its bin directory to
your
PATH
. For example, in Windows, edit the system properties from the Control
Panel and add the bin directory to the
PATH
environment variable.
You also need to add a system environment variable called
JAVA_HOME
and set
its value to the location of your Java bin directory containing your Java compiler
and runtime (on Windows, you can do this from the system properties under the
Control Panel). For example, if you installed your Java compiler under the
c:\jdk1-3 directory, you would set
JAVA_HOME
to
c:\jdk1-3
. The
PATH
and
JAVA_HOME
variables tell the Ant system where to find the Java tools it needs to run.
B.2 Setting up the build file
Ant uses an
XML
file to describe the build commands for an environment. Ant
provides a rich set of commands in which to build a flexible and powerful build
environment. In this appendix, we focus only on the commands we used for
building our examples. The Manning book referenced at the beginning of this
appendix is an excellent source of information on additional Ant commands.