How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?
There is another way. Please add two following lines before -vmargs in the .ini file:
-vm
{YOUR_JAVA_7_HOME}/jre/lib/server/libjvm.dylib
(remember these need to be separate lines) and also add a corresponding entry in 'Info.plist' file (add or modify array items under "Eclipse" key - each string child element corresponds to a command line parameter).
...
<key>Eclipse</key>
<array>
<string>-vm</string>
<string>/{MY_VM_HOME}/jre/lib/server/libjvm.dylib</string>
...
</array>
Alternatively just use -vm {YOUR_JAVA_7_HOME}/lib/server/libjvm.dylib
command line parameter when running eclipse from terminal.
I just added my comment to https://bugs.eclipse.org/bugs/show_bug.cgi?id=339788 regarding the inability to use the new Oracle JDK with Eclipse on OS X. Using the -vm option inside eclipse.ini does not work. The only way I found to work around this was to use the following shell script:
#!/bin/sh
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
LAUNCHER_JAR=/Applications/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
java \
-showversion \
-XX:MaxPermSize=256m \
-Xms1024m \
-Xmx1024m \
-Xdock:icon=/Applications/eclipse/Eclipse.app/Contents/Resources/Eclipse.icns \
-XstartOnFirstThread \
-Dorg.eclipse.swt.internal.carbon.smallFonts \
-Dosgi.requiredJavaVersion=1.5 \
-jar $LAUNCHER_JAR
Using the steps on http://mathiasbynens.be/notes/shell-script-mac-apps, I turned the script above into an application that I can keep on my dock.
Apparently there is a fix for Kepler that should come out in the next service release.
Meanwhile, there is a workaround that is mentioned in this bug that will allow you to run eclipse without ever installing JRE 1.6 from Apple: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361#c20
This will allow you to launch eclipse from the finder or spotlight but not the dock.
I've just tested this on OS X Mavericks, which during the update loses jre 6 and asks for it to be installed when you try to launch Eclipse. I have the latest Oracle JDK 1.7 installed of course.
Decline to do that and then to work around this, edit the jvm capabilities in /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Info.plist
<key>JVMCapabilities</key>
<array>
<string>CommandLine</string>
<string>JNI</string>
<string>BundledApp</string>
<string>WebStart</string>
<string>Applets</string>
</array>
With this fix, you don't need to specify the vm in eclipse.ini.
On a Mac above does not seem to work. For me with Eclipse KEPLER it worked by adding
-vm /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
at the end of my eclipse.ini (without that linebreak)
This finally changed my Eclipse Installation Details > Configuration from
-vm /System/Library/Frameworks/JavaVM.framework
to
-vm /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib
This did not work with my Eclipse INDIGO installation.
After installing Oracle JRE and JDK, open Info.plist inside Eclipse.app(right click, show contents) and paste after "Eclipse" "-vm/System/Library/Frameworks/JavaVM.framework/JavaVM"
Mine looks like this:
<key>Eclipse</key>
<array>
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/JavaVM</string>
<string>-keyring</string><string>~/.eclipse_keyring</string>
<string>-showlocation</string>
</array>
If you do that, you will not have to update the file after upgrading JRE.