Wednesday, June 22, 2011

Unable to locate tools.jar. Expected to find it in ..\Java\jre6\lib\tools.jar and installing Ant


How to resolve this error in windows

So this is a very common error. Almost everyone would stumble upon this one in a while. I myself got myself tangled in this error even though i closely followed the installation instructions (I installed ant in the way i mentioned below in this post) . Anyhow without further ado i am going to reveal the solution to solve this problem . The solution is a very simple one. You have to add the JAVA_HOME variable to the windows environment.

JAVA_HOME = C:\Program Files (x86)\Java\jdk1.6.0_23

If you get the error in linux this is how you resolve it


add the following to your .bashrc file
export JAVA_HOME=/somedirectory/jdk1.5.0_08/
And reload the .bashrc file

And after adding the windows environment variables, and began to run without much hesitation.
Well for those of you who wanna know how to install ant can read the clearly listed instructions
below. Should you happen to come across any difficulties, please don't hesitate to drop
a comment in the comments section below. I will be more than willing to help you with resolving
your issue.

Installing ant on windows

Step 1:- Goto http://ant.apache.org and download ant-current-bin.zip file.

Step 2:- Extract the zip file

Step 3:- Set environment variables. Path = location of bin folder (Eg:- D:\Program Files (x86)\apache-ant-1.8.2\bin) ANT_HOME = Location of ant home folder (Eg:- D:\Program Files (x86)\apache-ant-1.8.2) ANT_OPTS=-Xmx256M 

Notice i installed ant in drive D instead of C. You might want to install in drive C or in a entirely different drive. Its upto you guys to decide where you wanna install. Personally I prefer not to install my programs on drive C.

Installing ant on linux


Well how to you actually install ant on linux? I took the easy way out by telling apt-get to do all the hardwork
apt-get install ant
Well certainly apt-get saved my day :). Well but there is still a small configuration part left to do Add the following statements into your .bashrc file 

export ANT_OPTS="-Xmx256M"
export ANT_HOME=/usr/bin/ant
export PATH=$PATH:/usr/bin/ant/bin



No comments:

Post a Comment