The error is because of the UnsupportedClassVersionError
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.UnsupportedClassVersionError: yy/ii : Unsupported major.minor version 51.0 (unable to load class yy.ii)
JVM can only run a class file that is compiled using the same version or earlier version of Java Compiler . UnsupportedClassVersionError will happen if you use a lower version of JVM to run a class file that is compiled using an higher version of Java Compiler.
Configure the java compiler version (Setting 1)
The version of the Java Compiler is configured in the Project Properties ->Java Build Path-->Libraries Tab---> Select "JRE System Library" -->Edit
All sources in your project will then be compiled using this version of Java compiler
Configure WTP tomcat runtime s' JVM version (Setting 2)
As you are using the WTP tomcat to run the project , so the JVM that is used by the WTP tomcat will run your project 's compiled class. Its version is configured in the Servers View --> double click your tomcat server --> Runtime Environment
Please make sure the runtime JVM version (setting 2) is not lower than the JVM version that is used to compiled your sources (setting 1)
Sounds like you're compiling with JDK7 but running Tomcat with JDK6. One way or another, you're trying to run class files in a JVM that's older than the compiler that compiled them. Make sure to run Tomcat with the same JVM as what you run Eclipse in.
发布评论
评论(2)
该错误是由于
UnsupportedClassVersionError
JVM 只能运行使用相同版本或更早版本的 Java 编译器编译的类文件。如果您使用较低版本的 JVM 来运行使用较高版本的 Java 编译器编译的类文件,则会发生
UnsupportedClassVersionError
。配置java编译器版本(设置1)
Java编译器的版本在
Project Properties ->Java Build Path-->Libraries Tab--->中配置。选择“JRE System Library”-->Edit
然后,项目中的所有源代码都将使用此版本的 Java 编译器进行编译
配置WTP tomcat运行时的JVM版本(设置2)
由于您使用WTP tomcat来运行项目,因此WTP使用的JVM tomcat将运行您项目的编译类。它的版本在
Servers View --> 中配置。双击您的 tomcat 服务器 -->运行时环境
请确保运行时 JVM 版本(设置 2)为不低于用于编译源代码的 JVM 版本(设置 1)
The error is because of the
UnsupportedClassVersionError
JVM can only run a class file that is compiled using the same version or earlier version of Java Compiler .
UnsupportedClassVersionError
will happen if you use a lower version of JVM to run a class file that is compiled using an higher version of Java Compiler.Configure the java compiler version (Setting 1)
The version of the Java Compiler is configured in the
Project Properties ->Java Build Path-->Libraries Tab---> Select "JRE System Library" -->Edit
All sources in your project will then be compiled using this version of Java compiler
Configure WTP tomcat runtime s' JVM version (Setting 2)
As you are using the WTP tomcat to run the project , so the JVM that is used by the WTP tomcat will run your project 's compiled class. Its version is configured in the
Servers View --> double click your tomcat server --> Runtime Environment
Please make sure the runtime JVM version (setting 2) is not lower than the JVM version that is used to compiled your sources (setting 1)
听起来您正在使用 JDK7 进行编译,但使用 JDK6 运行 Tomcat。不管怎样,您尝试在比编译类文件的编译器更旧的 JVM 中运行类文件。确保使用与运行 Eclipse 相同的 JVM 来运行 Tomcat。
Sounds like you're compiling with JDK7 but running Tomcat with JDK6. One way or another, you're trying to run class files in a JVM that's older than the compiler that compiled them. Make sure to run Tomcat with the same JVM as what you run Eclipse in.