因为java.lang.UnsupportedClassVersionError [英] java.lang.UnsupportedClassVersionError

查看:110
本文介绍了因为java.lang.UnsupportedClassVersionError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行java程序时,我收到此错误..你能否建议我们为什么会收到此错误:

When I ran a java program I received this error.. Could you please suggest why do we get this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: 
    GenerateInvoice (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)


推荐答案

这个类是使用比用于执行的JDK更新的JDK编译的。

This class was compiled with a JDK more recent than the one used for execution.

最简单的方法是在执行程序的计算机上安装更新的JRE。如果您认为安装了最近的一个,请检查JAVA_HOME和PATH环境变量。

The easiest is to install a more recent JRE on the computer where you execute the program. If you think you installed a recent one, check the JAVA_HOME and PATH environment variables.

版本49是java 1.5。这意味着该类是用(或用于)旧的JDK编译的。您可能尝试使用JDK 1.4执行该类。你真的应该使用一个更新的(1.6或1.7,请参阅 java版本历史记录)。

Version 49 is java 1.5. That means the class was compiled with (or for) a JDK which is yet old. You probably tried to execute the class with JDK 1.4. You really should use one more recent (1.6 or 1.7, see java version history).

这篇关于因为java.lang.UnsupportedClassVersionError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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