Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant error when trying to build file, can't find tools.jar?

When I run ant it says:

Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed

What package can I use to download the file required > C:\Program Files\Java\jre6\lib\tools.jar

I just downloaded this one:

jre-6u19-windows-i586-s.exe

but unfortunately it appears that it was not on it...

like image 387
Derek Avatar asked Apr 11 '10 18:04

Derek


2 Answers

Java ships in 2 versions: JRE & SDK (used to be called JDK)

The JRE in addition to not containing the compiler, also doesn't contain all of the libraries available in the JDK (tools.jar is one of them)

When you download Java at: http://java.sun.com/javase/downloads/index.jsp, make sure to select the JDK version and install it. If you have both a JDK & JRE, make sure that ANT is using the JDK, you can check JAVA_HOME (environment variable), and on the commandline if you do "javac -version" you should get a version description.

like image 174
jayshao Avatar answered Nov 20 '22 03:11

jayshao


You need JDK for that.

Set JAVA_HOME to point to the JDK.

like image 26
Bozho Avatar answered Nov 20 '22 04:11

Bozho