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(ClassLo开发者_开发技巧ader.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?
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
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?
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.
精彩评论