- 主要是JDK编译版本不兼容导致的
- 解决方法:maven添加插件
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
- 查看编译的class文件版本:
javap -v hello.class
javap -verbose hello.class > hello.txt
Last modified 2019-1-27; size 6574 bytes MD5 checksum
b0bf5e8ad9e493b4be758ed37ba9becb Compiled from
“Hello.java” public class
com.bosssoft.platform.appframe.app.controller.AfaApplicationController
minor version: 0 major version: 51 flags: ACC_PUBLIC, ACC_SUPER
Unsupported major.minor version 52.0 对应于 JDK1.8(JRE1.8)
Unsupported major.minor version 51.0 对应于 JDK1.7(JRE1.7)
Unsupported major.minor version 50.0 对应于 JDK1.6(JRE1.6)
Unsupported major.minor version 49.0 对应于 JDK1.5(JRE1.5)