ANT Tutorial

Installing Ant

Ant does not provide an installation program. You have to download and configure it manually. Follow the below mentioned steps for ANT installation:
  • Download the latest version of ANT from here.
  • Unzip (or untar) the downloaded binaries to a specific installation directory.
  • Set the ANT_HOME environment variable to point to to the ant installation directory.
  • Set the JAVA_HOME environment variable to point to the JDK location.
  • Add ANT_HOME/bin to your system's PATH environment variable.
  • Test your Install - find the ant version.
    • At the Command Prompt (Run, cmd.exe), the command below should return similar results.:
      C:\>ant -version
      Apache Ant version 1.7.1 compiled on June 27 2008

    • Possible Errors:
      • Possible errors corrected by completing the Environment Variables section above.  When correcting these errors make sure you exit and re-launch the command prompt window.
        • Error:
          C:\>ant -version
          'ant' is not recognized as an internal or external command,
          operable program or batch file.
          Note: Probably PATH related.
        • Error:
          C:\>ant -version
          Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.6.0_03\lib\tools.jar
          Apache Ant version 1.7.0 compiled on December 13 2006
          Note: Probably JAVA_HOME related.  Point it to the JDK directory (not the JRE).
        • Error:
          C:\>ant -version
          Access is denied.
          Note: Probably JAVA_HOME related.