问题:MyEclipse 安装后执行一个java项目,出现下面的异常;
- java.lang.UnsupportedClassVersionError: Bad version number in .class file
- at java.lang.ClassLoader.defineClass1(Native Method)
- at java.lang.ClassLoader.defineClass(Unknown Source)
- at java.security.SecureClassLoader.defineClass(Unknown Source)
- at java.net.URLClassLoader.defineClass(Unknown Source)
- at java.net.URLClassLoader.access$100(Unknown Source)
- at java.net.URLClassLoader$1.run(Unknown Source)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(Unknown Source)
- at java.lang.ClassLoader.loadClass(Unknown Source)
- at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
- at java.lang.ClassLoader.loadClass(Unknown Source)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:683)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:425)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
- at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
解决方法:
1. java JDK版本确认。
2. TOMCAT JDK版本确认(MyEclipse TOMCAT)。
3. TOMCAT JDK版本确认(TOMCAT X.X)。
4. JRE 版本确认
我经过以上4步操作后编译正常了。
转载于:https://blog.51cto.com/jammeswang/475407