Java.lang.UnsupportedClassVersionError on MacOS
I'm trying to run a Java Applet that works fine on Windows XP (using the Eclipse IDE), but after I imported the project on MacOS X (using Eclipse on MacOS too), it was unable to start displaying this error:
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 anyone faced such a problem? I deleted all class files and built the whole project again, but it still throws this runtime error.
source to share
What this post is telling you is that your JRE doesn't know how to execute the class because the class is too newer version. Two obvious questions:
- What version of JRE do you have on Windows XP?
- Do you have Apple's latest JRE distribution that needs to support Java 6?
I would assume the version of JRE you are using is pre-Java 5.
source to share