Bad version number in .class file 错误原因
2008-07-21 11:23
671 查看
在用eclipse+myeclipse做Web service实例时,编译总是提示“Bad version number in .class file”,导致执行web service deploy总会提示错误,花了好大劲才知道原因是“Java Compile Level和指定编译的JRE两者间的版本不一致导致'”按以下步骤修改eclipse设置即可恢复正常。
eclisep--preferences--java--Compiler里面的Compiler compilance settings 要选和jdk一样的版本,jdk1.5要选5.0
出现的错误如下:
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)
This error is reported when someone is trying to deploy war which
contains java files which have been compiled by jdk version which is
lower than the jdk version which the tomcat uses.For example we
compiled java files using jdk 1.4 and now we are trying to deploy it in
tomcat which uses jdk 1.5.
Solution is either make tomcat uses older version of jdk or again
create java class files using the version that is being used by tomcat.
eclisep--preferences--java--Compiler里面的Compiler compilance settings 要选和jdk一样的版本,jdk1.5要选5.0
出现的错误如下:
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)
This error is reported when someone is trying to deploy war which
contains java files which have been compiled by jdk version which is
lower than the jdk version which the tomcat uses.For example we
compiled java files using jdk 1.4 and now we are trying to deploy it in
tomcat which uses jdk 1.5.
Solution is either make tomcat uses older version of jdk or again
create java class files using the version that is being used by tomcat.
相关文章推荐
- Bad version number in .class file 错误原因
- 关于Myeclipse报 Bad version number in .class file 错误原因
- tomcat 启动错误 java.lang.UnsupportedClassVersionError: Bad version number in .class file
- JAVA错误:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- 错误: java.lang.UnsupportedClassVersionError: Bad version number in .class file
- JAVA错误:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- Java Web项目部署遇到java.lang.UnsupportedClassVersionError: Bad version number in .class file,错误解决
- Bad version number in .class file (unable to load class ***)错误解决
- 错误:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- Tomcat启动web项目报Bad version number in .class file (unable to load class ...)错误的解决方法
- 关于运行错误:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- 问题版本关于运行错误:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- Bad version number in .class file错误
- Bad version number in .class file
- java.lang.UnsupportedClassVersionError: Bad version number in .class file异常
- 异常备忘:java.lang.UnsupportedClassVersionError: Bad version number in .class file
- Bad version number in .class file .
- 关于Bad version number in .class file的问题
- Bad version number in .class file的问题解决办法总结
- 当前项目与当前环境的JDK版本不匹配”Bad version number in .class file“