Install Ant

Jakob Jenkov
Last update: 2015-08-18

To install Ant you must first download an Ant release from the Ant website. The Ant website is here:

http://ant.apache.org

On this website you will find a download link. You need to download the binary distribution of Ant as a minimum and follow the install procedures.

It may also be a good idea to download the Ant manual which is distributed as a separate ZIP file. Ant actually has a pretty decent manual. The manual is also available online though, so you don't need to download it if accessing the manual online is fine for you.

The interested developer can also download the Ant source code and look through it to see how Ant is implemented.

Unzip Binary Distribution

Once you have downloaded the binary distribution (ZIP file) you must unzip it into the directory you want Ant to be installed into. Use your favourite ZIP tool to do this (e.g. WinZip, RAR, or Windows built-in ZIP tool).

Setting Environment Variables

To get the Ant command line tool to work you must set a few environment variables.

First of all you must set the JAVA_HOME environment variable to point to the directory into which you have installed your Java SDK. Note that you need a full SDK to run Ant, not just a Java Runtime Environment (JRE).

Second you must set the ANT_HOME environment variable to point to the directory into which you unzipped the binary Ant distribution.

Third you must add [ant-dir]/bin to the path environment variable. The [ant-dir] part should be the directory where you installed Ant (and not the text [ant-dir] literally). Since you have just set the ANT_HOME environment variable to point to the Ant install dir, you can add %ANT_HOME%/bin (on Windows) to the path variable, or ${ANT_HOME}/bin if you are using a Linux / Unix system.

Testing Your Ant Installation

When you have downloaded Ant, unzipped it and set the above environment variables, then Ant should be fully installed. To test if you have installed Ant correctly, open a command prompt and type:

ant -v

The ant command runs Ant and the -v flag should tell you what version of Ant you have installed. The output from this command should be something similar to this:

D:\>ant -version
Apache Ant(TM) version 1.9.6 compiled on June 29 2015

Jakob Jenkov

Featured Videos

Java Generics

Java ForkJoinPool

P2P Networks Introduction



















Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Previous
Next tutorial in this tutorial trail
Next