Unable to find a javac compiler Unable to find a javac compiler java java

Unable to find a javac compiler


All your ant stuff will work fine except the javac task which needs the tools.jar, located in the /lib directory from the JDK, JRE is not sufficient in that case. Therefore the hint from ant : "Unable to find a javac compiler;..."

When working with Eclipse the default setting points to your JRE installation.
So, one of your first steps after starting Eclipse for the first time should be :
Window > Preferences > Java > Installed JREs and change the settings from JRE to JDK.
Alternatively use :
Window > Preferences > Ant > Runtime > Classpath > Global Entries
and add the tools.jar from your JDK/lib folder


I had the same problem. In my case, I fixed it by pointing JAVA_HOME to the JDK folder, rather than the JDK\bin folder.


Currently you have set JAVA_HOME to your installed jre instead of the jdk.Install the current JDK then set JAVA_HOME to your JDK Directory.

You'll find the current jdk herehttp://www.oracle.com/technetwork/java/javase/downloads/index.html