Reputation: 2274
I am getting this weird thing. My JAVA_HOME is set to /usr/lib/jvm/java-6-openjdk-amd64. When I echo the variable I get the same result. But when I was using ant to build a project I am getting this error.
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-amd64/jre"
How is this possible? I installed jdk 6 downloaded from oracle's website but then I renamed it. Script is very long. So I am giving pastebin link: http://pastebin.com/mgJ1VbZ8
Upvotes: 2
Views: 1851
Reputation: 4781
From the script I see that you are checking if JAVA_HOME/lib/tools.jar is present and based on that make the assumption that you are running the JDK and not the JRE. But what seems to be happening is that your JDK bin folder is not on the PATH while your JRE bin folder is on the PATH. Javac is not found. Make sure that the JDK/bin folder is on the PATH when executing the ant build.xml. Easiest way to test is to see if "javac" is a valid command or not.
Upvotes: 2