简体   繁体   中英

DataNucleus Enhancer error while Setting up AppEngine

I am trying to set up AppEngine Backend Application project according to the tutorial on this site: https://cloud.google.com/resources/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial

My current Environment is as follows:

1.Eclipse 4.2 (64-bit)with ADT installed.(This was the Eclipse ADT bundle that I installed from the android sdk site itself)

2.Java 7u45(64-bit)

3.App Engine Java sdk 1.8.6.

Initially when I was using Java 6 for setting up the App engine using Generate App Engine Backend(Right click on project->Google->Generate AppEngine Backend)it was giving me a Failed to initialize App Engine:invalid App Engine at path error.

I figured out that it was a Java version error.So I installed Java 7 and the error disappeared.Now when I try to set up App engine using Generate App Engine Backend(Right click on project->Google->Generate AppEngine Backend)I get the following error:

Could not find main class: com.google.appengine.tools.enhancer.Enhance.Program will exit.

My console shows this: java.lang.UnsupportedClassVersionError: com/google/appengine/tools/enhancer/Enhance : Unsupported major.minor version 51.0

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
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)

copied from another thread. this worked for me on a mac running osx 10.9, I did not need to un-install anything and/or restart eclipse. I did delete JRE 6 from the eclipse java configuration

get jdk 7 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

verify using: java -version javac -version

in eclipse, add to preference/java/installed JREs/

1 Go to Preferences pane of eclipse
2 Open Java on the left pane
3 Click on Installed JREs
4 Add Button ---> Standard JVM and Next
5 Insert : /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home in the JRE Home TextBox
6 Next and Save the configuration

"Unsupported major.minor version 51.0" is what you see when you try to execute code compiled with Java 1.7 using an earlier JRE. You probably have an older JRE/JDK on your system that some part of the aparatus is trying to use instead of 1.7. Check your environment variables to see where the JAVA ones are pointing.

Thanks for the answer.The problem is solved.I checked my environment Path Variable, it was pointing to the JDK7 folder. The problem was I had both Java 6 and Java 7 installed on my computer with path variable pointing to JDK7 folder.Both java -version and javac -version on cmd were indicating Java 7,don't know why my eclipse was still using jre6. What I did to solve my problem is that I uninstalled Java 6 completely from my machine and restarted eclipse and the problem disappeared.But now I got a new problem while Generating AppEngine Backend. It gave me com.google.appengine.datnucleus.query cannot be resolved to a type. I restarted eclipse and even this problem disappeared. Any idea on why this error appeared? Am I misssing something?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM