java.lang.UnsupportedClassVersionError:不支持的major.minor版本51.0(无法加载类frontend.listener.StartupListener) [英] java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0 (unable to load class frontend.listener.StartupListener)

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

问题描述


可能重复:

不支持的主要.minor版本51.0

我有eclipse indigo和tomcat 7.0.29。仍然没有Serlvets可以加载!
我没有其他JDK或JRE比1.7一个!

I have eclipse indigo and tomcat 7.0.29. And still no Serlvets can be loaded! I have no other JDK or JRE than the 1.7 one!


  • Compilance level 1.7

  • JAVA_HOME指向JDK 1.7

  • JAVA_JRE指向JRE 1.7

  • 构建路径包含JDK 1.7

  • Java Facet 1.7

  • Compilance level 1.7
  • JAVA_HOME point to JDK 1.7
  • JAVA_JRE point to JRE 1.7
  • build path contains JDK 1.7
  • Java Facet 1.7

..但仍然不支持major.minor版本51.0

..but still Unsupported major.minor version 51.0

推荐答案

当您执行 java -version 时,您的输出是什么?这将告诉您正在运行的JVM是什么版本。

What is your output when you do java -version? This will tell you what version the running JVM is.

不支持的major.minor版本51.0错误可能意味着:

The Unsupported major.minor version 51.0 error could mean:


  • 您的服务器运行的是较低的Java版本,然后是用于编译Servlet的版本,反之亦然

无论哪种方式,卸载所有JVM运行时,包括JDK并下载最新版本并重新安装。这应该修复任何 Unsupported major.minor 错误,因为你将拥有最新的JRE和JDK(甚至可能比用于编译Servlet的更新)

Either way, uninstall all JVM runtimes including JDK and download latest and re-install. That should fix any Unsupported major.minor error as you will have the lastest JRE and JDK (Maybe even newer then the one used to compile the Servlet)

请参阅: http://www.java.com/ en / download / manual.jsp (7 Update 25)

See: http://www.java.com/en/download/manual.jsp (7 Update 25 )

在这里: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java平台(JDK)7u25)

and here: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform (JDK) 7u25)

分别为最新版本的JRE和JDK。

for the latest version of the JRE and JDK respectively.

编辑:

您的代码很可能是用Java7编写的,但是可能是使用Java7update4完成的,而您的系统运行的是Java7update3。因此,它们实际上是相同的主要版本,但次要版本不同。只有较大的次要版本向后兼容较低的次要版本。

Most likely your code was written in Java7 however maybe it was done using Java7update4 and your system is running Java7update3. Thus they both are effectively the same major version but the minor versions differ. Only the larger minor version is backward compatible with the lower minor version.

编辑2:
如果您的电脑上安装了多个jdk。您应该检查Apache Tomcat是否正在使用您正在编译程序的同一个(jre)。如果在安装apache后安装了新的jdk,通常不会选择新版本。

Edit 2 : If you have more than one jdk installed on your pc. you should check that Apache Tomcat is using the same one (jre) you are compiling your programs with. If you installed a new jdk after installing apache it normally won't select the new version.

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

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