项目运行不了java.lang.UnsupportedClassVersionError: Bad version number in .class file
求大神解答,此项目是从别人的机子拷到本机目录去的(之前在svn上直接导入也不行),别人的机子就可以运行。严重: Error deploying web application directory equip6.0
java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class com.oplink.common.listener.ApplicationListener)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4612)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) --------------------编程问答-------------------- 你拷贝别人项目的时候是不是把myeclipse的配置文件也拷进去啦,
像这种的.classpath、.settings都删掉,然后重新导入项目到myeclipse,让myeclipse自动生成这些文件,就ok啦
因为别人的指定的目录跟你的不一样,加载不到这个类就报错了 --------------------编程问答-------------------- jdk版本的问题,你win+r输入cmd打开控制台窗口输入:java -version 看下你的jdk的版本,然后再看下别人能运行的jdk的版本,你的版本要和他们的保持一致或比他们的高 --------------------编程问答-------------------- 别人的jdk版本比你的高,如果项目有源代码把拷贝的class文件删除了重新编译生成class文件,或者叫别人降低编译级别。 --------------------编程问答-------------------- 也不一定是jdk版本问题的,如果你机器上的jdk和svn上的jdk版本一致的话,看看x
eclipse-window-prefences里面的
java-Compiler 右侧的jdk版本是否和本地的一致
--------------------编程问答-------------------- 你jre版本过低
补充:Java , Web 开发