Apache ANT Configuration in Ubuntu

I am using Ubuntu Linux 9.04. JDK is located in “/usr/lib/jvm/java-6-sun” and ANT is located in “/usr/share/ant” in my machine. Following instruction shows instruction for configuration.

If you don’t know JAVA_HOME, you can retrieve with command “sudo update-alternatives –config java” as following.

xxx@xxx-desktop:~$ sudo update-alternatives --config java
There is only 1 program which provides java
(/usr/lib/jvm/java-6-sun/jre/bin/java). Nothing to configure.

First, open bash file with following code.

xxx@xxx-desktop:~$ sudo gedit /etc/bash.bashrc

Then, Insert Java home as path to JDK location and ANT home as path ANT location as mentioned below at the end of bash file. I entered path for locations according to my machine.

export ANT_HOME=/usr/share/ant
export JAVA_HOME=/usr/lib/jvm/java-6-sun
set path=$path $ANT_HOME/bin

Eventually, save and close the file. If you configured correctly, the terminal must show following note with the command “ant –version”.

xxx@xxx-desktop:~$ ant -version
Apache Ant version 1.7.1 compiled on November 10 2008
It means configuration is Ok.