Java app (jar) working in Windows but not Linux (made in Eclispe)

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?

Answer

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

Leave a Reply

Your email address will not be published. Required fields are marked *