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:
i tried all of the other solutions, but none worked. i finally found an approach that worked for me in eclipse:
- right click on the ant task name, e.g. "compilecustomsrc" in the
run as | external tool configurations
- then on the
separate jre: java se7or whatever your java 7 is named, then hit
your ant task will be executed, and will build correctly!
update ant to 1.9.x release as java 8 in incompatible with ant versions less tha 1.9 or after the comand put -dbuild.compiler=javac1.7, see the below:
ant release -dbuild.compiler=javac1.7
you can download and unzip ant 1.10 on your system and try to chnage the ant home in eclipse for your project to 1.10. it should work, read this for more details. http://devops-badal.blogspot.com/2017/02/class-not-found-javac18-issue-while.html
sometimes the issue while building the war through ant is also related to java version miss match in build.properties files as build.xml tries to use the java version mentioned in build.compiler property
check whether build.compiler property is same as intended java version.
you can download a newer version of eclipse, which includes a newer version of ant in the plugins directory. then, copy the ant jar into the older eclipse's plugin directory. eclipse will automatically point to the newer version of ant. this worked for older kepler with newer mars2 for me.
i had the same problem. and i was able to solve it within the build.xml by setting a property.
update ant to 1.9.x release as java 8 in incompatible with ant versions less tha 1.9
i tried all of the other solutions, but none worked. i finally found an approach that worked for me in eclipse, follow these steps:
right click on the ant task name, e.g. `mybuild.xml in the ant window.
run as | external tool configurations.
then on the jre tab, choose separate jre: java jdk7 or whatever your java 7 is named.
hit apply and then run.
your ant task will be executed, and will build correctly!
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 tried it with eclise and got the same error class not found: javac1.8
i verified the ant version on my system
apache ant(tm) version 1.9.6 compiled on june 29 2015
when i tried to run the build.xml from the command prompt, it worked. then i checked that in the eclipse, it was referring to the older version of the ant.
i simply edited the ant home path in the eclipse and it worked from here also. :)
below is the image from where need to edit the ant path in the eclipse.
- right click on the build.xml file
- run as
- external tool configurations
- select the classpath tab
now change the ant home path from here.
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.
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.
- Class Not Found Exception when running JUnit test
- javac1.8 class not found
- Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener
- PHP Class DateTime not found
- Jersey: A message body writer for Java Class and MIME mediatype application/json was not found
- maven + eclipse + tomcat : class not found exception
- Getting class not found Exception when running in eclipse
- Why I am getting class not found exception for Class.forName("com.mysql.jdbc.Driver");
- Class not found when using JAX-RS with Eclipse and Glassfish
- class not found exception Class.forName("com.mysql.jdbc.Driver") in webservice
- Scala IDE Error: Main method not found in class 'hello'
- Android: class NOT FOUND in Eclipse-built external jar but IS FOUND in Netbeans-built one
- Scala Main Class not found in Eclipse ide
- Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
- Eclipse Tomcat jsp class files sporadically are not found
- Eclipse Warnings: class javax.persistence.* not found
- eclipse jetty plugin Cross origin support Class not found
- Primefaces Dialog - Setter not found for property class
- Maven deployment: A message body writer for Java class java.lang.String (...) was not found
- Class 'org.springframework.http.converter.ResourceHttpMessageConverter' not found - how to correct?
- Eclipse and Apache Axis2 plugin Java Soap -- Class not found
- Updating v7 support jar causes class not found exception
- org/eclipse/e4/ui/model/application/ui/MUIElement Class Not Found , Java Eclipse Juno
- Class 'org.springframework.web.servlet.view.InternalResourceViewResolver' not found error
- Configuration error. Class [org.apache.derby.jdbc.EmbeddedDriver] not found while connecting to DB
- Class not found even if it's imported
- Warning in jsp : The tag handler class for "s:form" (org.apache.struts2.views.jsp.ui.FormTag) was not found on the Java Build Path
- SRVE9967W: The manifest class path xercesImpl.jar can not be found in jar file
- class not found exception
- Class not found exception after adding a new image to the resource folder
More Query from same tag
- Collapse selected code in eclipse
- StreamSupport collector and java 7
- Not able to get fxml ressource in eclipse?
- No packages or platforms in sdk manager
- logcat filter shows count but empty when selected
- How to Create Eclipse Project from SVN Working Copy
- SDK Manager - Won't install new packages (install button remains "unclickable")
- Eclipse/GCC: Undefined Reference to Extern Variable
- Configure Eclipse word-boundaries so 'Next-Word-Key' skips whole identifier
- Is there a way to print out two different arrays in two columns in Excel?
- eclipse Mars : Debug my own framework in an existing project
- spring deferredresult
- How to use html4 or lower version in eclipse mars?
- Why do existing imported projects not run in my Eclipse?
- android open sharedPreference xml file
- Optimal Eclipse CDT (C++) experience in March of 2010
- Android Runtime and Nullpoint Exceptions
- How to include jpcap library?
- Eclipse SWT label not showing within Composite
- Copying and Renaming Android Project in Eclipse without error
- Debug fork() in eclipse cdt
- How do I import a native library (.so file) into Eclipse?
- Installing egit on eclipse indigo
- Correctly using methods from additional class files
- How can one troubleshoot Java Web Services?
- While debugging, can Eclipse render values in a human-readable way?
- Helios unable to install Maven plugin
- Eclipse and PHP: directories in project's root
- what is difference between ColumnLabelProvider and ITableLabelProvider in Jface tableviewer?
- Eclipse JDT: Call 'correct indentation' programmatically?