javac1.8 class not found

JAVA_HOME = C:\Program Files (x86)\Java\jdk1.5.0_16
JRE_HOME = C:\Program Files (x86)\Java\jre1.5.0_16

Your JAVA_HOME and JRE_HOME are set to the Java 1.5 installation hence 1.8 binaries (like javac) are not found. Set them to the Java 1.8 installation and you should be fine.


I had this same issue. I had JAVA_HOME and JRE_HOME set correctly. I also had Ant > 1.9.

What I did to fix it is go into Eclipse to Window -> Preferences. Expand Ant and select Runtime. By default the Classpath tab should be selected and on the right hand side there is a button called "Ant Home". Click this button and double check it is pointed to your Ant folder.


Class not found: javac1.8

This error is known to happen with Apache Ant versions less than 1.9.0 - which aren't compatible with Java 8. If you're using a version of Ant < 1.9.0, you should update to a 1.9.x release.

Here is the related bug report: https://issues.apache.org/bugzilla/show_bug.cgi?id=53347

Btw, if you just want to compile with Java 8, but don't need to compile any actual Java 8 syntax, then you can pass the following argument to javac as a workaround, which would allow you to continue using an older version of Ant:

-Dbuild.compiler=javac1.7

As a follow-on to Kristian Holdhus's answer (marked as correct), you can instead use the compiler attribute on the Ant javac task. Setting compiler="modern" should be both backward (as far back as 1.3) and forward compatible.

This avoids the need to set the Java System property named build.compiler. Only in the absence of explicitly setting the compiler attribute on the javac task, will Ant use the value of the build.compiler as a fallback.