java.lang.UnsupportedClassVersionError
Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source)
The version number shown describes the version of the JRE the class file is compatible with.
“major.minor version 51.0 ”表示jar包是用哪个JDK版本编译的,你现在使用的JDK版本低于项目依赖jar包使用的版本
一个项目使用的JDK版本必须等于或高于项目所依赖的jar包编译所使用的JDK版本
The reported major numbers are:
Java SE 9 = 53, 53对应JDK版本为java 9 Java SE 8 = 52, 52对应JDK版本为java 8 Java SE 7 = 51, 51对应JDK版本为java 7 Java SE 6.0 = 50, 50对应JDK版本为java 6 Java SE 5.0 = 49, 49对应JDK版本为java 5 JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45
(Source: Wikipedia)
To fix the actual problem you should try to either run the Java code with a newer version of Java JRE or specify the target parameter to the Java compiler to instruct the compiler to create code compatible with earlier Java versions.
(译)要解决实际问题,您应该尝试使用较新版本的Java JRE运行Java代码,或者向Java编译器指定目标参数,以指示编译器创建与早期Java版本兼容的代码。
For example, in order to generate class files compatible with Java 1.4, use the following command line:
javac -target 1.4 HelloWorld.java
With newer versions of the Java compiler you are likely to get a warning about the bootstrap class path not being set. More information about this error is available in blog post New javac warning for setting an older source without bootclasspath.