0

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:

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.

1
  • Which version of OSX are you running and what version of Java? Commented May 4, 2009 at 2:25

1 Answer 1

4

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. Two obvious questions are:

  1. What version of the JRE do you have on Windows XP?
  2. Do you have Apple's latest distro of the JRE, which is supposed to support Java 6?

I would guess that the version of the JRE you're using know is pre-Java 5.

Sign up to request clarification or add additional context in comments.

3 Comments

-agree. That Error happens when some class (maybe in a 3rd party Jar, not your code) was compiled with a newer JDK than what you are running. It typically only happens for different major versions (1.4-1.5, 1.5-1.6, ...).
you can check the version by using the Java Preferences application on os X.
It helped me solve the problem! Thanks a lot :) Eclipse was using JRE 1.5 as default environment. Changing it to 1.6 solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.