15
votes

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.

12

12 Answers

32
votes

I had this same problem with a fresh install of Eclipse Mars on OSX. I had installed the JRE from https://java.com/en/download/ (which is the top google search result for "java download" for me.

This failed for me with the same message "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required"

Then I saw a comment that I should get the JRE/JDK from oracle instead:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

After downloading the most recent JDK from Oracle Eclipse starts fine.

9
votes

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.

1
votes

You can modify Info.plist inside Eclipse.app (right clic on Eclipse.app --> show package contents) and specify -vm after <key>Eclipse</key>.

For example :

<key>Eclipse</key>
    <array>
        <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/bin/java</string>
        <string>-keyring</string><string>~/.eclipse_keyring</string>
        <string>-showlocation</string>
    </array>
1
votes

Ensure you installed the jdk 7 or above. If you have a Mac you most likely have 1.6.0.jdk. To check your java development kit (jdk) version go to the terminal and browse to:

/Library/Java/JavaVirtualMachines

Next, if you see 1.6.0.jdk then you did not install the latest version of the jdk. Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to install the latest jdk. Next use the browse out to the same file path aforementioned and ensure the latest jdk is in there (i.e. jdk1.8.0_141.jdk).

0
votes

To specify Java 6 for OS X:

-vm

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java

For versions of Mac OS X 10.7+ the location has changed to

/Library/Java/JavaVirtualMachines/<''jdk_name_ver''>/Contents/Home/...

eclipse.ini > Specifying the JVM

Try any of these solutions

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

Mountain Lion with Java 7 only

Eclipse still using java 6 as jre on Mac OSX

0
votes

As I found out, we don't need to un-install an existing Java 1.6. Just installing or deploying a newer version 1.7 or 1.8, and setting the JAVA_HOME, along with the below given activities will solve the issue.

Check your c:/Windows/System32 (as I had this issue in windows). You will find junk java processes (java.exe, javaws.exe etc). Delete them all.

Deleting just java.exe will reflect in your PATH but eclipse still picks the javaws from c:/windows/system32. This is because, usually in PATH, you will have C:/Windows/System32 as the first entry. So, this will override any JAVA_HOME entry in the path.

Try starting the eclipse. It should work like charm! Atleast it did for me.

0
votes

Okay so I have been struggling with this issue for a few days with Eclipse Neon and Oxygen. I was doing the below steps -

  1. Check java -version from Terminal. It showed version as 1.7
  2. Go to System Preferences -> Java -> Update Java version. Version 1.8 was downloaded and updated.
  3. Went to Terminal again to confirm and this time it showed the version as 1.8.

But it still didn't work!! What was I missing now??

Here is what you need to keep in mind -- By default when you type the below command it shows the JRE version.

java -version

You need JDK to start your Eclipse installation. Please go to Java download page

and download the latest JDK version and you should be good to go.

Don't try to remove the Java in /System/Library/ - firstly this will not be allowed (you need to login as root user) and secondly you don't know the dependencies this Java version has on your other applications. Hope this helps!

-1
votes

Check your system variables ($JAVA_HOME specifically). This may be helpful:
http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/

-1
votes
  1. Install the updated JDK
  2. Update the environment variables: here's how
  3. If still not working uninstall the older JDK
-2
votes

I see that you have installed the Java plugin and not the jdk. You can download the JDK from Oracle Downloads section.

You can remove the Java Plugin and install JDK from oracle downloads to resolve your issue.

-2
votes

I have had the same problem as noted above. I could not get Eclipse to install because of Java incompatibilities. The sequence I followed goes like this:

  1. Upgraded to MAC OS Sierra

  2. Downloaded the Eclipse installer but was prompted that I needed to instal a legacy Java.Installed Java 1.6

  3. Was unable to install Eclipse and was prompted that I needed Java 1.7 or greater. Downloaded and installed Java 1.8 Ran the terminal code 'java -version' // this will check your jre version. This showed returned Java 1.6 despite the fact that I had upgraded to 1.8. The Java version listed in the Java control panel said 1.8

  4. Tried multiple downloads of eclipse and Java and multiple restarts always with the same result.

  5. Visited the Oracle web page. I could not find the above reference to 8u73 and 8u74 but I did find and option to download 1.8.0_12. I did this. It installed without difficulty, and then I was able to install Eclipse without difficulty.