Ant needs tools.jar and unable to find it

Genadinik picture Genadinik · Apr 6, 2011 · Viewed 65.1k times · Source

I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error:

Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar

While the path to the jdk is correct, the tools.jar really wasn't there. Is it actually supposed to be there or did I get some config/installation thing wrong?

Answer

Kevin Qi picture Kevin Qi · Sep 18, 2013

It seems like you can have Java installed in /usr/lib/jvm/java-6-openjdk but only have the JRE, not the JDK. This fixed it for me:

sudo apt-get install openjdk-6-jdk