Saturday, May 12, 2012

Solved: Missing JDK - Error with Ant (Java build tool)

I ran into 2 errors while trying to build ZXing mainly due to the fact that I only installed the Java 6 Open JRE but I was missing the JDK (looked at /usr/lib/jvm/java-6-openjdk).


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

...... /zxing-2.0/javase/build.xml:41: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"

Problem solved by installing the JDK from Ubuntu Software Centre.

You can also use: sudo apt-get install openjdk-6-jdk

Platform: Ubuntu 11.10

As a side note, I find it very useful to document all the major installations done on this blog mainly to aid my fallible memory.