Developing Web Applications With Ant by Richard Hightower - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Setting Up Your Environment to Run Ant

If you are running Unix, install Ant in ~/tools/ant; if you are running Windows, install Ant in c:\tools\ant. You can set up the environment variables in Windows by using Control Panel. However, for your convenience, we created a Unix shell script (setenv.sh) and a Windows batch file (setenv.bat) that will set up the required environment variables for you.

Your Unix setenv.sh file should look something like this:

#
# Setup build environment variables using Bourne shell
#
export USR_ROOT=~
export JAVA_HOME=${USR_ROOT}/jdk1.4
export ANT_HOME=${USR_ROOT}/tools/ant
export PATH=${PATH}:${ANT_HOME}/bin

Your Windows setenv.bat file should look something like this:

:
: Setup build environment variables using DOS Batch
:
set USR_ROOT=c:
set JAVA_HOME=%USR_ROOT%\jdk1.4set
CLASSPATH=%USR_ROOT%\jdk1.4\lib\tools.jar;%CLASSPATH%
set ANT_HOME=%USR_ROOT%\tools\Ant
PATH=%PATH%;%ANT_HOME%\bin

Both of these setup files begin by setting JAVA_HOME to specify the location where you installed the JDK. This setting should reflect your local development environment--make adjustments accordingly. Then, the files set up the environment variable ANT_HOME, the location where you installed Ant.

Note
The examples in this chapter assume that you have installed Ant in c:\tools\ant on Windows and in ~/tools/ant on Unix.