java.lang.UnsupportedClassVersionError: yy/ii : Unsupported major.minor version 51.0 [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionThis is how error happened.Now i am using Eclipse Indigo integrated with apache tomcat 6.0 and also changed the default port to 9090.
Caused by: java.lang.UnsupportedClassVersionError: yy/ii : Unsupported major.minor version 51.0 (unable to load class yy.ii)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1851) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassL开发者_高级运维oader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1068)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
... 6 more
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.
精彩评论