2

I've made this application in a Windows environment. In eclipse, I made an executable .jar file by going to File > Export > Executable Jar

I can launch the app in Windows by openening it with Java. However in Linux, when I run java -jar app.jar, I get this:

Exception in thread "main" java.lang.UnsupportedClassVersionError: ConfigReader (Unsupported major.minor version 50.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)

What does unsupported class version error mean?

3 Answers3

6

The application was probably written in Java 6 and you are trying to run it in Java 5. You can either build it under Java 5 in eclipse or install Java 6 onto your linux machine

John Vint
  • 39,695
  • 7
  • 78
  • 108
  • Damn! I didn't even consider the versions of Java I was using. Thanks for pointing that out. Will accept in 6 minutes. –  Jul 11 '11 at 16:06
2

The version that the jar was compiled in is higher than the version you are trying to run in.

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/UnsupportedClassVersionError.html

java.lang.UnsupportedClassVersionError: Bad version number in .class file?

Community
  • 1
  • 1
Kal
  • 24,724
  • 7
  • 65
  • 65
1

It means that the JAR file was compiled to a version of the JVM bytecode that the currently installed JVM cannot run.

Odds are excellent that the software compiled on a newer version of Java, but are attempting to run it on an older version.

Edwin Buck
  • 69,361
  • 7
  • 100
  • 138