Monday, July 16, 2007

How to install Apache Ant on MS-Windows

This post of course is not for advanced Java developers!Though it is going to be used as a reference for anyone who wishes to install for the very first time Apache Ant and make his Java development easier and more fun.More posts regarding Ant will follow.So simple steps.

1. Make sure you have properly install java on your machine. To check that, just open a new command promot (Start-> Run -> cmd) and type java -version, it should look like the picture below.

2. Download the Apache Ant zip binary, from here, and I suggest you unzip to a less complex path in your system. I usually use either C:\ or D:\. I also like to rename the extracted folder to something simpler like \ant17. So as you see in the image below i have extracted the contents of the zip, renamed the extracted folder and moved it to C:\ .

3.Make sure you have set the enviroment variable called JAVA_HOME, it is generally a good practise to set it anyway anyhow.Usually this variable points to the top directory of our JDK installation.Right clik on MyComputer ->Properties ->Advanced -> Enviromental Variables -> New User variable -> JAVA_HOME and the path. See the image below.

4. Create the enviroment variable called ANT_HOME. Right clik on MyComputer ->Properties ->Advanced -> Enviromental Variables -> New User variable. See the image below.

5. Edit the variable Path on the System variables section.Just select the Path variable and press Edit.

6.Add the the Path Variable which you have in edit mode the path to the Apache Ant's bin directory. Actually you scroll to the end of the line (it might be big) and you add the following.


Then you just press ok and close the related windows

7.Close all the existing command line windows - remember everytime we alter some variables in the system the changes will be only take affect if we open a new command line- the existing one wont have the new updates.In the new window just type ant. You shoud see an error message saying error in build.xml. Yes we are done. This is normal and is properly setup and is just looking for a build.xml to find directives and start working. More on the build.xml file to a later post. You may try typing ant - version, that would print the version of the ant utility.

Thats all, its really easy, if you have any further questions please leave a comment!Happy development with Apache Ant- a java developer's most!


  1. Τι δουλειά έχεις macάνθρωπος με τα παράθυρα; :P

  2. ε πολλοί ρωτάνε κατα καιρούς, και είπα να το γράψω να μείνει δεν ειναι κάτι σπουδαίο. Απο την άλλη θα ακολουθήσουν και άλλα related κειμενάκια οπότε θα χρησιμοποιηθεί ως reference!

  3. αυτα τα βασικα πραγματα που πρεπει να ξερει ενας developer ειναι καλο να υπαρχουν ως tutorial... σωστος ο Παρις!