javac1.8 class not found

后端 未结 12 1768
予麋鹿
予麋鹿 2020-11-27 13:10

I have installed two jdks - jdk 1.5 and jdk 1.8. I have following Ant build.xml config file :


    

        
相关标签:
12条回答
  • 2020-11-27 13:52

    I had the same problem. And I was able to solve it within the build.xml by setting a property.

    <property "build.compiler=javac1.7">
    
    0 讨论(0)
  • 2020-11-27 13:54

    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.

    0 讨论(0)
  • 2020-11-27 13:57

    I tried it with Eclise and got the same error Class not found: javac1.8

    I verified the ANT version on my system

    >ant -version

    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.

    1. Right click on the build.xml file
    2. Run as
    3. External tool configurations
    4. Select the classpath tab

    Now change the ANT Home path from here.

    0 讨论(0)
  • 2020-11-27 14:02

    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

    0 讨论(0)
  • 2020-11-27 14:03

    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.

    0 讨论(0)
  • 2020-11-27 14:04
    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.

    0 讨论(0)
提交回复
热议问题