Installing Apache Ant in Windows
Apache Ant is a Java-based build tool. To install ant, please follow the instructions.
1. Download Ant.
2. Unzip downloaded file.
3. Rename the unzipped directory to “ant”. You can choose another directory name, remember that name is not too long. A long name will create a problem in Win95, Win98 and WinMe.
On these systems, the script used to launch Ant will have problems if ANT_HOME is a long filename (i.e. a filename which is not of the format known as “8.3″). This is due to limitations in the OS’s handling of the "for" batch-file statement. It is recommended, therefore, that Ant be installed in a short, 8.3 path, such as C:\Ant.
4. Set ANT_HOME environment variable.
My Computer -> Advanced System Properties -> Environment Variable.
Now on the system variable click on New to add a new Environment Variable.
5. Update Path environment variable. e.g.(oldpath;%ANT_HOME%/bin;)
You don’t require to setup CLASSPATH because of the following reasons
- Do not ever set
CLASSPATH. Ant does not need it, it only causes confusion and breaks things. - If you ignore the previous rule, do not ever, ever, put quotes in the
CLASSPATH, even if there is a space in a directory. This will break Ant, and it is not needed. - If you ignore the first rule, do not ever, ever, have a trailing backslash in a
CLASSPATH, as it breaks Ant’s ability to quote the string. Again, this is not needed for the correct operation of theCLASSPATHenvironment variable, even if a DOS directory is to be added to the path. - You can stop Ant using the
CLASSPATHenvironment variable by setting the-noclasspathoption on the command line. This is an easy way to test for classpath-related problems.
To test if Ant is installed successfully, go to command prompt and type ant-h. It will show you help regarding ant usages.
Related Post
Comments
23 Responses to “Installing Apache Ant in Windows”
Leave a Reply
Hello Sir,
i followed the all above steps but getting Error ant is not recognized external or enternal command,could you please let me know any other way to trace the issue;
Have you got it fixed?
Hello,
I’ve been trying to install ant on my windows XP and I can’t make it work.. I’ve follow every step and it keeps saying that ant is not recognized external or internal command….
What could be the problem?
Open command prompt ant type following
user> echo %path%check if it show you
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;c:\ant\bin;C:\Program Fi
les\Java\jdk1.6.0_02\bin;
It must be showing ant in your path. If it doesn’t then you need to open your system environment variable and set ant in your path.
After setting it open new command prompt window.
Thanks.. I fixed it.. it was some other problem with the variables.. but it works fine now.. thanks..
hey i am a bit lost i have downloaded ant and i have unzipped the flie to my D drive and called it and i am a bit lost with step 4
Set ANT_HOME environment variable.
My Computer -> Advanced System Properties -> Environment Variable.
Now on the system variable click on New to add a new Environment Variable. i have done all this and a tab comes up and ask for the veriable name and variable value what should i put i there?
and i have changed the path to have D:\ant in it does it also need too have the java\jdk1.6.02\bin; in it to make it work??
i have gone into my compters properties
sorry there are a few mistakes in the last post i have called the unzipped file ant and the last sentance should not be there im just a bit tired ha ha
1. Variable name must be “ANT_HOME” (without quotes).
2. JDK is required and JAVA_HOME should be pointing to current installed JDK. Java may be required as you might be using javac command in some ant task.
when you say it should be pointing too jdk do you mean that the veriable value should be something like this?? D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;d:\ant\bin;d:\Program Files\Java\jdk1.6.0_13
or do i have the wrong thing??
any help would be great as i am using this for my end of year project in college
can we set windows system property values through ant script?. can we change it randomly?
hey this is gr8.. thanks
Hi,
Thanks for the step by step guidance
I made an installer called WinAnt to automate these steps. You can download it from http://code.google.com/p/winant/
i dont hav admin right’s in my system………so can i add another path variable in my user variable C:\ANT_HOME\bin this ?
pls help…………
For windows..
Assume Ant is installed in c:\ant\. The following sets up the environment:
set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk-1.5.0.05
set PATH=%PATH%;%ANT_HOME%\bin
For unix/linux(bash)
Assume Ant is installed in /usr/local/ant. The following sets up the environment:
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/local/jdk-1.5.0.05
export PATH=${PATH}:${ANT_HOME}/bin
For linux/unix(csh)
setenv ANT_HOME /usr/local/ant
setenv JAVA_HOME /usr/local/jdk/jdk-1.5.0.05
set path=( $path $ANT_HOME/bin )
Try thzz …it definitely works..
thanx mason..windows installer has been very handy to get d work done soon!
Thanks a lot for your help
This is an extra ordinary help….
thanks a lot guys..
Thank’s for your article. :-bd
hi
Thanks for your gr8 article
i have one doubt
i have put variable name= ANT_HOME
what will be varialbe value?
thanx in advance?
This is the root location of the directory where you unzipped ant. e.g. if you unzipped ant into c drive then your ANT_HOME variable is “c:\ant”
tnx for the reply
it works now.