Appendix A. Installation

 

If there is one area where Ant could be improved, it’s in the area of installation. It still has a fairly manual installation process, and a few things can go wrong. Here’s a summary of how to install Ant, and also a troubleshooting guide in case something goes awry.

Before you begin

Before installing Ant, check that a Java SE Software Development Kit, otherwise known as JDK, is installed on the target system. Type javac at a command prompt; if a usage message doesn’t appear, then either a JDK needs to be installed or the PATH environment variable path isn’t set up correctly. Sun distributes their versions under http://java.sun.com/javase/—you need to download the appropriate JDK for your system.

On Windows, install the JDK on a path without spaces in it, such as c:\java\jdk, instead of a path such as C:\Program Files\Java. Spaces in paths can confuse Ant and other programs.

After installing the JDK, Ant requires the environment variable JAVA_HOME to be set to the directory into which it was installed. You should also append JAVA_HOME\bin to the PATH environment variable, so that you can run the SDK’s programs from the command line. Some Ant tasks depend on this, since they run these programs.

The steps to install Ant

The core stages of the Ant installation process are the same regardless of the platform:

1.  Download Ant.

2.  Unzip or untar it into a directory.

3.  Set up some environment variables to point to the JDK and Ant.

Setting up Ant on Windows

Setting up Ant on Unix

Installation configuration

Troubleshooting installation