0

I did a project using jdk 1.7. And then I changed it to the 1.6, I got the following error:

java.lang.UnsupportedClassVersionError: com/simulator/server/Start : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
Could not find the main class: com.simulator.server.Start.  Program will exit.
Exception in thread "main" Java Result: 1

I'm using NetBeans platform and that changes are did using the NetBeans.

DT7
  • 1,615
  • 14
  • 26
JhonF
  • 199
  • 2
  • 2
  • 7

4 Answers4

1

Recompile your project on JDK 1.6.

Basanth Roy
  • 6,272
  • 5
  • 25
  • 25
0

Unsupported major.minor version error happens when your code is compiled on a different java version(jdk) and you are trying to run it a different java version(jre).

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
  • more often because when you compile on a newer version (1.7) than the runtime (1.6) and thus your code has new, and previously unsupported features. – vandale Oct 03 '13 at 14:37
0

You should ether switch back to java 7, or recompile your code with language level 6 (assuming you aren't using any new Java 7 features).

Mureinik
  • 297,002
  • 52
  • 306
  • 350
0

yes you get this exception when you compile your code with a higher version and try to run it with a lower one.

Either recompile with java 6(and run with java 6 as you are) or run with java 7(as it is already compiled with java 7).

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289