Set $JAVA_HOME in eclipse but ANT Cannot Find Java Compiler

Shahryar picture Shahryar · Mar 14, 2011 · Viewed 10.8k times · Source

I add this line to /home/{user}/.bashrc file:

 export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

but when I want to run an ant file in eclipse got this error:

BUILD FAILED
/home/bakish/Work/new/hadoop-0.20.2/build.xml:316: 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"

what should I do?

Thanks

Answer

Alex_M picture Alex_M · Mar 14, 2011

go to preferences / java / installed jre's -> add a new jre and select the location of your jre/jdk