Reputation: 33
Playing with a little network program, created a Jar with netbeans. Runs just fine on my computer java 1.7.0.60, but when I take it to another computer that has a newer version of java 1.7.0_65 it will not run, I get this error:
C:\Program Files (x86)\Java\jre7\bin>java -jar ReverseEchoServer.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: reverseechose
rver/SocketClient : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
I have read several posts on here that talk about PATH, have looked at that but no luck. I belive its the version differance. Any advice would be most appreciated, Thanks!
Upvotes: 1
Views: 162
Reputation: 13726
Java class files compiled for Java 7 have Major/Minor versions 51/0. If you have a JVM implementation that wasn't prepared for Java 7, it would give you this error indicating "I don't know how to interpret and run this class file."
Try either compiling for an older JVM version, or upgrade your JVM.
Use the Target and specify the version in which it needs to be executed using target switch followed by version number.
javac -target 1.7 yourJarName.jar
Upvotes: 1