3

While I was trying to run a gwt project,it got errors below

java.lang.UnsupportedClassVersionError: com/google/appengine/tools/development/agent/AppEngineDevAgent : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)

FATAL ERROR in native method: processing of -javaagent failed Exception in thread "main"

My JRE System Library is jre6,and I select 1.6 in Compiler compliance level,but it still the same,so what should I do?

user2853610
  • 33
  • 1
  • 4

2 Answers2

8

AppEngine requires Java 7, and the latest versions are compiled with Java 7 compliance (-target 1.7), so the classes can't be loaded in a Java 6 VM. This is actually what the exception tells you.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • Finally I change my JRE System Library to jre7,and select Compiler compliance level to 1.6,it do not get errors,so I find it very strange.. – user2853610 Oct 07 '13 at 09:56
  • Because the JDK 7 knows how to deal with classes compiled **for** Java 7, and the _compliance_ of your own code is independent from that (someone could theoretically take your compiled classes and run them with some version of the AppEngine classes compiled for Java 6) – Thomas Broyer Oct 07 '13 at 12:26
  • Yes change to jre7 and compile project and then run.. – Akash5288 Apr 30 '14 at 11:27
1

I believe these are the current version numbers:

J2SE 7 = 51,  //Note this one

J2SE 6.0 = 50,

J2SE 5.0 = 49,

JDK 1.4 = 48,

JDK 1.3 = 47,

JDK 1.2 = 46,

JDK 1.1 = 45

51.0 appears to be Java 7, which would mean in your case as you are using 1.6 requires you to update your java (jre and compiler)

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
Levenal
  • 3,796
  • 3
  • 24
  • 29