Error: Unable to locate tools.jar

Error: Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar This error message means that your Java is missing the file tools.jar which is a Java JDK file.

Our solution is to install the Java JDK and JRE pacakges. install-java-openjdk-6-jdk-and-jre

To install the Java JDK and JRE

Depending on your system, there are a variety of ways to install the Java JDK and JRE.

On Ubuntu, the default Java JDK is called openjdk-6-jdk

To install OpenJDK on Ubuntu, there are three major packages:

  apt-get install openjdk-6-jdk
  apt-get install openjdk-6-jre-headless
  apt-get install openjdk-6-jre-lib

To find tools.jar

To find tools.jar:
  find -type f -name tools.jar
On our system, tools.jar is here:

What causes "Unable to locate tools.jar"?

This error can happen when you install a package such as ant which depends on the Java JRE, but not the Java JDK.

Some developers believe that the ant package should also require the Java JDK, which would solve this error.

When you try to build something using ant, the build fails because your system is missing openjdk-6-jdk.

What's Next?

blog comments powered by Disqus