0

The problem might be that at school we probably use a different eclipse version than the one I use at home. We had to make a fraction class and a junit class for it.

java.lang.UnsupportedClassVersionError: FractionTest : Unsupported major.minor version 52.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$100(Unknown Source)
at java.net.URLClassLoader$1.run(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 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

picked up _JAVA_OPTIONS: -Xmx512M

That's the error. What should i do to fix this? Also, when i opened eclipse today, and opened the work space, it said something about a newer workspace vesion.

sepp2k
  • 363,768
  • 54
  • 674
  • 675
tbone255
  • 3
  • 2
  • Java version mismatch. Execute using JRE 8. http://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0 – kinjelom Sep 19 '15 at 02:45

2 Answers2

0

It's happening because of a higher jdk version during compile time than runtime. If you are using eclipse, check window -> preferences -> java -> compiler. What are these set to? They should all be the same.

Adam Wolf
  • 309
  • 1
  • 4
  • 12
0

It seems like you have compiled the source code in one version of jdk and trying to run it on another version of jre. Just recompile the source code where you want to run it. Otherwise install the same version of jre for the jdk which is used for compilation.

Regarding eclipse, from the exception it seems like the code was compiled using Java 8. So install Java 8 and use eclipse luna-r or mars for better comparability.

Kesavamoorthi
  • 959
  • 2
  • 11
  • 21