wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant installation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant installation" Watch "Ant installation" New topic
Author

Ant installation

Shweta Pershad
Greenhorn

Joined: Sep 08, 2004
Posts: 23
Hi,

I have downloaded Ant 1.6.2 and extracted all its files. I am supposed to add an environment variable called ANT_HOME and add a few things to the classpath. How do I add the variables? I mean where and how? What commands do I use if I am running Windows XP? I have never used Ant and am new to changing things on the system.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
See How to set the classpath FAQ.

Read or look down where it describes how to set on Windows, you can set ANT_HOME the same way.
Shweta Pershad
Greenhorn

Joined: Sep 08, 2004
Posts: 23
Thanks.

One important question....when downloading Ant which link should I follow? I got the binary type, and I am guessing that was not right 'cause nothing was recognised by my computer after setting the PATH and CLASSPATH. I am running Windows XP.

Secondly, is it necessary to first install Xerces-J for Ant to work?
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Did you set ANT_HOME? What java version are you using?

I assumed you were following the installation instructions from Ant manual:

Windows and OS/2
Assume Ant is installed in c:\ant\. The following sets up the environment:

set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk1.2.2
set PATH=%PATH%;%ANT_HOME%\bin


What do you mean by "nothing was recognised by my computer"?

After setting ANT_HOME, JAVA_HOME, and adding ANT_HOME's bin directory to the path (I usually add JAVA_HOME's bin as well) check what you get when you run these:

java -version
ant -version
ant -help
set ANT_HOME
set JAVA_HOME
set PATH
which java.exe
which javac.exe
Shweta Pershad
Greenhorn

Joined: Sep 08, 2004
Posts: 23
Yes I am following the Apache mannual. And I am running JSDK1.4.2_07. When I ran the ant -version command following is what I got...


Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\j2re1.4.2_07\lib\tools.jar
Apache Ant version 1.6.2 compiled on July 16 2004


I had downloaded ant-current-bin.zip and apache-ant-1.6.2-src.zip (this was from source/ folder). Am I facing this problem because I did not download the right zip file? Or did I get too much?

I have declared ANT_HOME and JAVA_HOME environment variables and added them to PATH.

The 'which' command was also not recognised on my system, maybe because I am running WindowsXP.

So, what must I do now?

Originally posted by Carol Enderlin:
Did you set ANT_HOME? What java version are you using?

I assumed you were following the installation instructions from Ant manual:


What do you mean by "nothing was recognised by my computer"?

After setting ANT_HOME, JAVA_HOME, and adding ANT_HOME's bin directory to the path (I usually add JAVA_HOME's bin as well) check what you get when you run these:

java -version
ant -version
ant -help
set ANT_HOME
set JAVA_HOME
set PATH
which java.exe
which javac.exe
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
What do you get running javac -version?

Your post indicates that ant is looking for tools.jar as :
C:\Program Files\Java\j2re1.4.2_07\lib\tools.jar

That sounds like a JRE (runtime environnment) and not a JDK.

Check your java installation and/or pointers to java in path and classpath.
Shweta Pershad
Greenhorn

Joined: Sep 08, 2004
Posts: 23
Yup, that is where the problem was. My path variable was not pointing to the right installation. Fixed it now. Everything runs fine.....Thanks!
Scott Huddleston, Chicago IL
Greenhorn

Joined: Mar 09, 2005
Posts: 1
I had this problem when my JAVA_HOME environment variable contained a space at the end. It was screwing up my PATH. Once the path was set correctly everything worked fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant installation
 
Similar Threads
Netbeans IDE for Part II preperation
ANT: calling a target from another build file
Adding A New Group/Role/User to WL8.1 Using Ant
executing jars
How to change default buid in WSAD using ant