Pages

Monday, May 19, 2014

How to install Apache Ant on Windows 7

Ant is a favorite build tool for most of front-end developers & is an excellent choice for JavaScript also. Ant install is like a breeze on MAC but is a bit tricky on Windows. The instructions below are only for Windows 7.
  1. Make sure JDK is installed already from http://bit.ly/V7yv7Z. For my purpose I have used x86 version instructions would also be on the same lines.
  2. Download the .zip for the binaries from http://ant.apache.org/bindownload.cgi.
  3. Extract the binaries on the path C:java\ant\ where [java] and [ant] would be self created folders you can store in any directory structure of your preference.
  4. Set up Environment variables with the names JAVA_HOME & ANT_HOME.
  5. To set up the variables › Right Click My Computer › Click Properties › Click Advanced system settings  › Click Environment Variables › Click New System Variable.
  6. For ant variable name would be ANT_HOME and value would be c:\java\ant\.
  7. For JDK depending on the version and platform i.e. x86 the path would be c:\Program Files (x86)\Java\jdk1.7.0_09. The version 1.7.0_09 might only differ if you have installed the x86 platform base of JDK in the default location seleted by JDK installer.
  8. Open Command Prompt & from there go to c:\java\ant\bin and type command antand you should get the message Buildfile: build.xml does not exist!
    Build Failed!
  9. This means ant is installed properly and looking for build.xml
  10. If you want to be able to run ant command from anywhere while inside Command prompt need to add your ant path in my case which is C:\java\ant\bin to Path environment variable there will be other paths also there each separated by semi-colon(;).

Credits:

http://ant.apache.org/bindownload.cgi
_________________________________OR______________________________________

1. Download ANT http://ant.apache.org/
2. Unzip it and rename it to ant

3.Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed, to do it on command prompt type this (Assume Ant is installed in E:\ant\.)

set ANT_HOME=E:\ant
set JAVA_HOME=D:\Program Files\Java\jdk1.6.0_03
set PATH=%PATH%;%ANT_HOME%\bin

In windows 7 you can go to Control Panel\All Control Panel Items\System or right click on Computer and then to “Advance system setting”
-Choose Advanced Tab
-Press  Environtmen Variables Button
-In the System Variables, click New Button

Give the Variable Name:ANT_HOME
Give the Value: 
E:\ant
Click OK
Then,we’ll add new ANT_HOME path,
And Click again on New Button if you do not have ‘path’ Variable in there, if so select it and edit as
Give the Variable Name:path
Give the Value D:\Program Files\Java\jdk1.6.0_03\bin;%ANT_HOME%\bin
Click OK

4. Check wheter ANT works correctly or not.
In the command prompt, type: 
ant -version
Friends, If you like this post, please share with your friends on Facebook and Google+ and recommend us on Google using the g+1 button on the top right hand corner.

No comments:

Post a Comment