简体   繁体   中英

Mac OS-X Eclipse with Google App Engine setup: JDK version error when launching Eclipse

On my Mac OS-X Mavericks, I had the Eclipse Java Enterprise Ed Helios version with JRE 1.6 installed.

I updated my Eclipse version to Eclipse Kepler Java Enterprise Edition (Eclipse Kelpler v 4.3)

Then I installed Google App Engine components (Basically downloaded and install Google Pugin for Kepler ... from https://developers.google.com/eclipse/docs/install-eclipse-4.3 )

When I started up the new Eclipse Kepler I got the following error (screenshot below) indicating my JRE (v 1.6) was out-of-date and I need version 1.7.0+

在此输入图像描述

So I downloaded the latest JDK v 1.8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html

I installed this with step by step instructions from: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html

I set the SDK version in Eclipse by going to Preferences->Java->Installed JREs (and navigating to the folder containing the new JRE)

However when I restart Eclipse I still get the same error ie (JRE needs to be 1.7.0 or above)

**** Any ideas what setting I am missing or what else I need to set? ****

Here's a running log and screenshots of things I have tried:

Screenshots of latest system preference (java) settings and Eclipse java preferences:

在此输入图像描述

在此输入图像描述

And here are the contents of eclipse.ini

-startup ../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.200.v20140116-2212
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/libjvm.dylib
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

UPDATE: I edited my eclipse.ini to ensure that the -vm specification for jvm 1.7 was across two lines as suggested by @manouti

-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/server/libjvm.dylib

And now when I start eclipse the get this different error. Checking online it appears I need to add some capabilities to the JVM init file ....

在此输入图像描述

I checked the following blog http://burrsutter.blogspot.com/2013/12/eclipse-does-not-contain.html and per recommendations posted there, I updated the capabilities section of my JVM 7 info.plist file as follows:

<key>JVMCapabilities</key>
      <array>
            <string>CommandLine</string>
            <string>JNI</string>
            <string>BundleApp</string>
            <string>WebStart</string>
            <string>Applet</string>
      </array>

That blog also recommends a different value for the -vm option in the eclipse.ini ...

Also set the java version to 1.7 at startup, by adding the following line to ~/.bash_profile

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`

Still get the capabilities error above "does not contain the JNI_CreateJavaVM symbol"

I tried changing the -vm line in eclipse.ini to that recommended in burrsutter's blog http://burrsutter.blogspot.com/2013/12/eclipse-does-not-contain.html ie set -vm in eclipse.ini to:

-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java

With this I continue to get the capabilities error shown above ...

also tried

-vm
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java

... With this the original error comes back ie "JRE version is 1.6.0 version 1.7.0 or later is needed"

Make sure that the new JDK is set in your CLASSPATH and PATH environment variables. Eclipse may still be using the old JDK1.6. You can call java -version to check the default version used on your machine. Also make sure that the eclipse.ini file in your Eclipse installation directory does not launch using JDK1.6. You can edit eclipse.ini so that it launches using JDK1.8:

-vm
/path/to/java1_8

The initial impetus for this procedure came from @manouti (thank you!) but I've added all the steps needed for a newbie to integrate app engine with Eclipse on a Mac OSCX Mavericks. Here is the step by step solution:

  • Ensure that you have Java version 1.7 installed on your Mac OSX Mavericks:

download the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html

Step by step instuctions to download and install JDK 1.7 are here: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html

Edit in terminal vi ~/.bash_profile and add the following line: export JAVA_HOME= /usr/libexec/java_home -v 1.7

Reboot your Mac.

  • Next ensure that you have Eclipse_kepler.

check version on mac. Current Mac Pros have the 64 bit version …. (in terminal type: 'uname -a' if you see 'RELEASE_X86_64 x86_64' it means you have the 64 bit version)

Delete whatever versons of eclipse you have. - delete everything that has org.eclipse in its name from folders ~/Library/Saved Application State, ~/Library/Preferences and ~/Library/Caches and then delete the eclipse folder (ensure that you copy your Workspaces folder to a safe place before you do this)

Update Eclipse to version Eclipse EE Kepler for Mac 64 bit by downloading from http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/kepler/SR2/eclipse-jee-kepler-SR2-macosx-cocoa-x86_64.tar.gz

When you start up Eclipse you will notice that the Java settings in Kepler are set to default 1.7

(Use the eclipse software update feature and type in URL: http://dl.google.com/eclipse/plugin/4.3 ) Just install Google Plugin for Eclipse.

  • Now you are all set to begin the tutorial Steps to Integrate XCode/iOS with Google App Engine

https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial

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