Ubuntu – How to install ANT 1.9.6

apache-antsoftware installationsource-packages

I want to install ANT from downloaded zip: apache-ant-1.9.6-bin.zip.
How to do it ?

Best Answer

That is the Windows file you downloaded. You need the .tar.gz and that download has a file named INSTALL with a link to the installation manual:

For installation instructions see the manual in the docs subdirectory or online at http://ant.apache.org/manual/index.html.

It is a binairy download so all you need to to do un-tar it to a location (I would advice something like /opt/apache-ant-1.9.6/ with a symlink to /opt/apache-ant/ so you can install several verions).

You need JDK (1.7+ adviced) and set a few things:

  • Add the bin directory to your path
  • Set the ANT_HOME environment variable to the directory where you installed Ant.
  • Optionally, set the JAVA_HOME environment variable

Example:

  • Assume Ant is installed in /opt/apache-ant/. The following sets up the environment:

    export ANT_HOME=/opt/apache-ant/
    export JAVA_HOME=/opt/apache-ant/jdk1.7.0_51
    export PATH=${PATH}:${ANT_HOME}/bin
    

The link to the manual also has instructions on checking if all went well.