Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?

I'm trying to get the new 1.7 JDK working with Eclipse (this is Oracle's official release).

I don't mean just pointing Eclipse to it so you can use it in projects, this works fine, but actually making Eclipse run using the 1.7 JVM.

I've moved the new JVM to the top of the list in Java Preferences, but Eclipse still starts with 1.6. If I disable 1.6 in Java Preferences I get a dialog immediately after I double-click on Eclipse saying "Failed to create the Java Virtual Machine".

edit: I added the following to my eclipse.ini just before the -vmargs:

-vm /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java 

Yet in the Eclipse installation details dialog I still see:

java.runtime.version=1.6.0_31-b04-415-11M3646 

edit 2: here are the contents of my eclipse.ini file: https://gist.github.com/2512578

like image 651
sanity Avatar asked Apr 27 '12 14:04

sanity


People also ask

Where is my JDK installed Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation. This directory also contains copyright, README, and src.

Which JDK is used by Eclipse?

Current releases of Eclipse require Java 11 JRE/JDK or newer.


1 Answers

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.

like image 62
Jan Arciuchiewicz Avatar answered Oct 04 '22 03:10

Jan Arciuchiewicz