rosjava unsupported class version error [closed]
Hi everyone,
I have absolutely no idea what has gone wrong here. One day I have a perfectly working system using rosjava, and then the next morning I am getting this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/ros/RosRun : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.ros.RosRun. Program will exit.
I haven't changed any code, updated any files, nothing. This just happened. Does anyone have any idea why?
Things I have tried: After doing research on errors similar to this, I found out that it occurs when java versions do not match. 51 is Java 1.7. So I checked out my own java version with:
java -version
and got:
java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (6b33-1.13.5-1ubuntu0.12.04)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
So I am running java 1.6. Makes sense, the error is telling me RosRun is 1.7. Let me check.
$ file RosRun.class
RosRun.class: compiled Java class data, version 50.0 (Java 1.6)
Well thats not the case. That means my code must be compiling in 1.7. Let me check:
$ file project/build/classes/main/com/github/hsmrs_gui/project/GuiNode.class
project/build/classes/main/com/github/hsmrs_gui/project/GuiNode.class: compiled Java class data, version 50.0 (Java 1.6)
I'm at a loss. Can anyone help?
Ok, so what was the solution in the end?
I upgraded everything to 1.7