Skip to main content

Unsupported major.minor version 51.0

5 replies [Last post]
denn0069
Offline
Joined: 2007-04-01
Points: 0

I am currently using netbeans, just got it set up on vista, and I can't figure out why I'm getting the error:
java.lang.UnsupportedClassVersionError: project1/MainProject : Unsupported major.minor version 51.0
But, if I use code that is identical to mine that is made by netbeans I don't get the error, so it only happens when I make a not pre-defined project.

Any help is greatly appreciated, probably a stupid mistake on my part :P
Thank you,
denn0069

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kirillcool
Offline
Joined: 2004-11-17
Points: 0

It means that you compiled your classes under a specific JDK, but then try to run them under older version of JDK. So, you can't run classes compiled with JDK 6.0 under JDK 5.0. The same with classes compiled under JDK 7.0 when you try to run them under JDK 6.0.

esedcey
Offline
Joined: 2007-06-04
Points: 0

Thanks for help. I just uninstalled all of the jdks and jres, and reinstalled the jdk6. Now everthings fine :)

jorisvh
Offline
Joined: 2008-06-05
Points: 0

I have the same problem. I use netbeans-6.1 in Ubuntu 7.10.
I just uninstalled all of the jdks and jres, and reinstalled the jdk6 but nothing works with me, even worse, I couldn't start netbeans anymore!
I uninstalled these packages:
sun-java6-bin
sun-java6-jre
sun-java6-jdk and reinstalled
icedtea-java7-bin
icedtea-java7-jdk
icedtea-java7-jre

After this I could start netbeans and open an existing project.
I've found this in my project:
Compile classpath: /usr/lib/openoffice/program/classes/agenda.jar
Runtime Classpath: /usr/lib/openoffice/program/classes/agenda.jar
and
Boot classpath:
/usr/lib/jvm/java-7-icedtea/jre/lib/resources.jar ...

I think the problem is in the Compile and Runtime classpath. But I couldn't change that.
Is this possible? How can I change this for all my java projects?

esedcey
Offline
Joined: 2007-06-04
Points: 0

Hello,
I wanted to bump this question up, becouse i m now having exactly the same problem.

I wanted to continue one of my previous projects, (I m using eclipse, by the way) I used "New Project for an Existing Source" to import that project into my workspace. When i tried to run my main class, the same exception occured. Here s the log:

java.lang.UnsupportedClassVersionError: netplay/DotArenaServerM : Unsupported major.minor version 51.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$000(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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"

I was coding this project in Java 6. I first tried to run in a java7 snapshot, then installed java6u2 again, still not working and same problem.
It s almost have been my first year in java, so im not that experienced. Thanks for any help.
Have a good day.

realslix
Offline
Joined: 2011-12-07
Points: 0

I got this problem by switching to jre1.6 from jre1.7 in eclipse, but my jdk and the compiled files in the /bin folder were jdk7, so this problem appears -

to solve this problem - in my case I simply cleared the bin folder and recompiled with jdk1.6

regards

Alexej