bootstrap class path not set in conjunction with -source 1.6

后端 未结 2 1126
一向
一向 2021-01-12 01:35

I am upgrading my application from java 1.6 to 1.7. When I try to build using Maven 3.2.1, my build fails with below error msg:

[ERROR] Failed to execute goa         


        
相关标签:
2条回答
  • 2021-01-12 02:01

    I solved it using below configuration in my compiler plugin:

    <fork>true</fork>
    <executable>${JAVA_HOME}/bin/javac</executable>
    <compilerVersion>1.7</compilerVersion>
    <source>1.7</source>
    <target>1.7</target>  
    

    This will use the JDK which you have defined in your JAVA_HOME environment property.

    0 讨论(0)
  • 2021-01-12 02:05

    Quote from this post:

    Java 5.0 and 6 used to have poor support for compiling classes to target older versions of Java. It always supported the previous version, but often no more. Even if you could compile for previous version, you had to be careful not to use functionality which did exist in the previous versions.

    You should either include -Xbootclasspath when using javac:

    javac -Xbootclasspath:/path/to/jdk6/rt.jar -target 1.6 -source 1.6 Main.java
    

    or compile using -target 1.7 (or higher of course):

    javac -target 1.7 -source 1.7 Main.java
    

    or use javac of jdk 6:

    /path/to/jdk6/bin/javac Main.java
    
    0 讨论(0)
提交回复
热议问题