简体   繁体   English

MacOS上的Java.lang.UnsupportedClassVersionError

[英]Java.lang.UnsupportedClassVersionError on MacOS

I am trying to run an Java Applet application that ran fine on Windows XP (using Eclipse IDE) but after I imported the project on MacOS X (Using Eclipse on MacOS too), it fails to run displaying this error: 我试图运行在Windows XP(使用Eclipse IDE)上运行良好的Java Applet应用程序,但是在MacOS X上导入了项目(也在MacOS上也使用Eclipse)后,它无法运行并显示以下错误:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at edu.isi.calo.mapping.gui.DieselUtil.(DieselUtil.java:9) at edu.isi.diesel.DieselEditor.processSettingsFile(DieselEditor.java:597) at edu.isi.diesel.DieselEditor.main(DieselEditor.java:80)

Has anybody faced such a problem? 有人遇到过这样的问题吗? I deleted all the class files and built the whole project again but it still pops up this runtime error. 我删除了所有类文件,并再次构建了整个项目,但它仍然弹出此运行时错误。

What that message is telling you is that your JRE does not know how to execute the class because the class has too new a version. 该消息告诉您,因为类的版本太新,您的JRE不知道如何执行该类。 Two obvious questions are: 两个明显的问题是:

  1. What version of the JRE do you have on Windows XP? 您在Windows XP上拥有什么版本的JRE?
  2. Do you have Apple's latest distro of the JRE , which is supposed to support Java 6? 您是否拥有Apple 最新的JRE发行版,该发行版应该支持Java 6?

I would guess that the version of the JRE you're using know is pre-Java 5. 我猜您正在使用的JRE版本是Java 5之前的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM