Ant requires Java Runtime .
For information on how to install Java Development Kit see Installing Java Development Kit on Debian Linux .
At present the latest version of Ant is 1.8.4.
You can download it here
Scroll down to where it says Mirror and choose the mirror server closest to you.
Or just scroll down lower and click on the download link ( apache-ant-1.8.4.zip ).
Save that file to a directory on your computer. I'm going to use Downloads as a directory where apache-ant-1.8.4.zip was saved.
I prefer to install additional software in /opt directory. You can choose any other directory.
You need to login as root .
If you're using Gnome desktop open Root Terminal window ( Applications/Accessories/Root Terminal ).
Otherwise just open a terminal and press ENTER after each command:
That should create a directory called apache-ant-1.8.4 .
su cd /opt mkdir ant cd ant cp ~/Downloads/apache-ant-1.8.4.zip . unzip apache-ant-1.8.4.zip
I like to provide a symlink (a.k.a. symbolic or soft link) called default linked to current software version.
This makes things easier when upgrading to newer version of Ant. For example:
rm apache-ant-1.8.4.zip ln -s apache-ant-1.8.4 default
If directory structure is the same everything should work out of the box.
rm default unzip apache-ant-1.8.5.zip ln -s apache-ant-1.8.5 default
You should see the following messages:
cd /opt/ant/default/bin ./ant
Buildfile: build.xml does not exist!
This is to be expected since there is no build.xml in /opt/ant/default/bin directory.
Make Ant available to all users
( /etc/alternatives directory contains links to all replaceable binaries):
I prefer to link all binary files located in /opt to /usr/local/bin directory.
cd /etc/alternatives ln -s /opt/ant/default/bin/ant
This is pretty much it.
cd /usr/local/bin ln -s /etc/alternatives/ant
Export ANT_HOME property
If you want to set ANT_HOME system property do this:
At the end of file add this line:
cd /etc vi profile
Save and close. Changes will not be visible until you logout and login again.
Note that when using Gnome terminal window closing it and opening it again does not really log you out.
So check ANT_HOME settings after you reboot Linux:
This should print all system properties. Look for ANT_HOME at the top.