Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception in thread "main" java.lang.UnsupportedClassVersionError: danbikel/parser/Trainer (Unsupported major.minor version 50.0)

Tags:

java

I'm trying to run a parser built in Java, but every time I try to use the class, I get the above error ("Exception in thread "main" java.lang.UnsupportedClassVersionError: danbikel/parser/Trainer (Unsupported major.minor version 50.0)").

From what I've read, this may be a problem with a mismatch between the versions of Java used to compile and run the code; but I've made sure that my JAVA_HOME environment is set to version 1.6, which is the version recommended by the parser's installation guide.

There are older versions of Java installed on the server, but I can't do anything about that. Is there anything else I can do about this error?

like image 325
Caitlin Avatar asked Mar 30 '11 04:03

Caitlin


2 Answers

Use sudo update-alternatives --config java and set the version you may want to use if you are using a Debian-derived distro (such as Ubuntu).

like image 96
false9striker Avatar answered Sep 26 '22 01:09

false9striker


Aside from setting JAVA_HOME appropriately (which you've done), ensure that you're executing the right version of the java executable. e.g., on Debian or Ubuntu, execute /usr/lib/jvm/java-6-openjdk/jre/bin/java directly, if /usr/bin/java points to the wrong version.

You can use the -version option to verify the version of the launcher you're using. Try java -version and /usr/lib/jvm/java-6-openjdk/jre/bin/java -version and see if the output is any different.

like image 29
Chris Jester-Young Avatar answered Sep 24 '22 01:09

Chris Jester-Young