Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not Opening After Installing JDK 9 on OSX

I'm running OS X 10.11.3 El Capitan. Until recently, I had Eclipse Mars.1 and JDK 8u72 working smoothly.

Recently I installed the early snapshot release of JDK 9, from "jdk9.java.net/download/". After that, Eclipse doesn't open, constantly telling me that an error has occurred and telling me to refer to a log.

I did some research about why Eclipse would crash after the installation of JDK 9 and found that eclipse.org has in fact released update patches for Eclipse Mars and Neon to support the use of JDK 9, as detailed by the article at https://www.eclipse.org/community/eclipse_newsletter/2015/june/article4.php. Download instructions for the Mars and Neon support patches are given as well.

Because both ways of downloading the support patch (either from the Eclipse Marketplace or p2 repository) require for Eclipse to be running, and since my Eclipse was not starting at all, I figured I would need a workaround. This is what I did:

(1) Uninstall JDK 9 (by deleting the "jdk-9.jdk" directory in /Library/Java/JavaVirtualMachines/)

(2) Launch Eclipse and install the update patch (I did so using the p2 repository)

(3) Re-Install JDK 9 and try to launch Eclipse again.

At this point, one would expect that Eclipse should run, having installed the Java 9 Support patch for Mars.1. However, Eclipse still does not run, giving me the same error message as before.

Click on THIS LINK to view the log file that Eclipse last told me to refer to when it crashed on startup. It was located at "/Applications/Eclipse/Contents/Eclipse/configuration/".

Thanks a ton to whoever can help figure out how to get Eclipse running on a Mac with JDK 9 installed!

like image 312
kranberry Avatar asked Feb 02 '16 00:02

kranberry


2 Answers

You can specify the java version that should be used to run eclipse.

Edit the file

/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

and insert the following line:

-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/bin

To get the full path of available jdk version, you can run

/usr/libexec/java_home --verbose

However, note the "/bin" at the end of the path as described here: https://wiki.eclipse.org/Eclipse.ini

This allows you to run eclipse with the given java version regardless of what other versions are installed. This did the trick for me, at least until eclipse is fully compatible with JDK 9.

like image 88
Jan Gassen Avatar answered Sep 17 '22 22:09

Jan Gassen


Exactly as posted by Jan Gassen (unfortunately my Reputation is not enough to comment his post). Edit the eclipse.ini file inside the eclipse.app, insert the following lines at the top of the file:

-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin

These two lines must be added at top of the file and not at the end, otherwise it will not work (at least in my case with Neon and Java 10)

like image 45
nhaggen Avatar answered Sep 20 '22 22:09

nhaggen