Java Question

I installed Java 7 but Eclipse keep saying that 1.6 is not suitable for this product

I'm using latest version of Eclipse Luna on Mac OS X 10.9.4. Whenever I try to open the Eclipse it says "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required". I installed java 7 (JRE, I don't need JDK) but still I'm getting the same error. I tried java -version and the output was "java version 1.6.0_65". I can see the java icon on my system preferences. I also restarted my Mac to see if that works but that doesn't help either. I searched on google and some people suggesting other users to change Eclipse.ini file, the instructions wasn't clear and I'm a java beginner so I've no idea where and what to edit. Any step by step instructions will be appreciated.

Answer Source

A potential solution to your problem might be to uninstall Java6 (provided by Apple itself) and only have Java7 installed in your system. This only applies in case you have no applications that desperately need the old Java6 version to be installed.

To remove the Apple-like Java6 installation open a Terminal and:

sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

After this step you should only have Java7 by Oracle installed in your system. To verify, open another terminal and do a:

java -version

It should display something like "java version "1.7.0_XX" where XX is the current update version of the Java7 installation. If not: proceed with the next step.

Redefine the JAVA_HOME variable (to support IDEs like Eclipse and other developer tools...), which helps detecting where the "active" Java installation is situated in your system. Open a terminal and (Note: replace XX first!):

sudo rm /Library/Java/Home

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home /Library/Java/Home

Afterwards, a fresh installation of Eclipse should detect Java7 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to:

Preferences -> Java -> Installed JREs. Then remove the old Java6 system entry AND add new path (see above) with the name Java7.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download