UnsupportedClassVersionError不支持major.minor版本51.0无法加载类 [英] UnsupportedClassVersionError unsupported major.minor version 51.0 unable to load class

查看:374
本文介绍了UnsupportedClassVersionError不支持major.minor版本51.0无法加载类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

线程中的异常“ main” java.lang.UnsupportedClassVersionError:a(Unsupporte d major.minor版本51.0)

我使用jdk 1.7.0,Eclipse IDE(Indigo)在java中开发了一个Web应用程序,并在eclipse ide中配置的tomcat(apache-tomcat-7.0.23)上运行该应用程序。

i have developed an web application in java using jdk 1.7.0 ,Eclipse IDE (Indigo) and is running that application on the tomcat(apache-tomcat-7.0.23) configured in eclipse ide.

当我试图通过IDE运行我的应用程序时它运行正常,但是当我创建它的战争并将其放在apache部署文件夹(webapps)中并从IDE外部运行它时开始页面成功加载但当我尝试对它进行任何操作时它给我一个错误

When i tried to run my application through IDE it runs fine but when i created its war and placed it in apache deployment folder(webapps) and run it from outside the IDE the start page gets successfully loaded but when i tried to do any operation over it it gives me an error

UnsupportedClassVersionError unsupported major.minor version 51.0 unable to load class bean.myclassname

我已经检查了它的jdk 1.7以外的java版本。 0并且JAVA_HOME环境变量也设置为C:\Program Files \ Java @ \\ _ddk1.7.0_01。

i have checked the java version outside ide its jdk 1.7.0 and also the JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.7.0_01 .

推荐答案

可能在外部运行时,它不使用相同版本的Java。仔细查看启动脚本 ,找到它运行的Java版本。您还应该检查启动日志以查看它们是否指示正在运行的版本。

Well presumably it's not using the same version of Java when running it externally. Look through the startup scripts carefully to find where it picks up the version of Java to run. You should also check the startup logs to see whether they indicate which version is running.

或者,除非您需要 Java 7功能,否则可以随时将Eclipse中的编译器首选项更改为目标1.6。

Alternatively, unless you need the Java 7 features, you could always change your compiler preferences in Eclipse to target 1.6 instead.

这篇关于UnsupportedClassVersionError不支持major.minor版本51.0无法加载类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆