rosjava unsupported class version error [closed]

asked 2015-02-25 12:54:20 -0500

Robocop87 gravatar image

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(
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Robocop87
close date 2015-02-25 13:55:02.928898


Ok, so what was the solution in the end?

gvdhoorn gravatar image gvdhoorn  ( 2015-02-25 14:27:41 -0500 )edit

I upgraded everything to 1.7

Robocop87 gravatar image Robocop87  ( 2015-03-05 14:48:18 -0500 )edit