You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "mengln (JIRA)" <ji...@apache.org> on 2019/07/18 06:17:00 UTC

[jira] [Created] (MANTRUN-220) java.lang.UnsupportedClassVersionError: Bad version number in .class file

mengln created MANTRUN-220:
------------------------------

             Summary: java.lang.UnsupportedClassVersionError: Bad version number in .class file
                 Key: MANTRUN-220
                 URL: https://issues.apache.org/jira/browse/MANTRUN-220
             Project: Maven Antrun Plugin
          Issue Type: Bug
    Affects Versions: 1.8
         Environment: windows10+ Maven 3.6.0+java 11
            Reporter: mengln


pom.xml:

<plugin>
 <artifactId>maven-antrun-plugin</artifactId>
 <executions>
 <execution>
 <id>install with JDK5</id>
 <phase>install</phase>
 <configuration>
 <tasks>
 <exec executable="${basedir}/mvn_jdk5.bat" output="log.txt" failonerror="true">
 <arg value="install"/>
 <arg value="..\\a-geronimo"/>
 </exec>
 </tasks>
 </configuration>
 <goals>
 <goal>run</goal>
 </goals>
 </execution>
 <execution>
 <id>clean with JDK5</id>
 <phase>clean</phase>
 <configuration>
 <tasks>
 <exec executable="${basedir}/mvn_jdk5.bat" output="log.txt" failonerror="true">
 <arg value="clean"/>
 <arg value="..\\a-geronimo"/>
 </exec>
 </tasks>
 </configuration>
 <goals>
 <goal>run</goal>
 </goals>
 </execution>
 </executions>
 </plugin>

 

Previously used is java6+maven2.2.1, you need to make some projects compile with java5, compile without problems. Now need to change the version of java, use java11+maven3.6.0, compile problems, query maven3.6.0 support java1.7 and above, but change java_home to 1.7 will give an error: Java heap space.

 

Error message:

JAVA_HOME : "G:\buildtool\jdk1.5.0_18"
Work Directory : "..\\a-geronimo "
Command : mvn clean
java.lang.UnsupportedClassVersionError: Bad version number in .class file
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
 at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main" ErrorLevel:1

 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)