15

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.

Roman C
  • 49,761
  • 33
  • 66
  • 176

12 Answers12

32

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.

floatingpoint
  • 570
  • 5
  • 8
  • 3
    Thanks, after installing the JDK from Oracle my default Java version (java -version) has become 1.8.0_60-b27. It showed 1.6.0_65 when I only installed the Java from Java website (link from Apple). Also there wasn't any file under `/Library/Java/JavaVirtualMachines` when I only installed the https://java.com/en/download/ version. – Liwen Aug 28 '15 at 21:06
  • 4
    This should be the accepted answer as it doesn't force you into deleting previous versions. – user1366265 Dec 04 '15 at 14:59
  • 1
    Confirming that installing the JDK/JRE updates worked for me as well on Mac OSX. Thanks! – chainwork Apr 14 '16 at 18:48
  • This should be the correct answer. I had this issue on fresh install. Just get the JDK from Oracle. Thanks! – Ross Dec 30 '16 at 22:23
9

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.

Community
  • 1
  • 1
MWiesner
  • 8,868
  • 11
  • 36
  • 70
  • 2
    Okay I uninstalled the Java 1.6 and now when I run the java -version command it says "No Java runtime present, requesting install" opens a popup and take me to oracle website. But I installed Java 7 update 65 and I can access the control panel in my system preferences. I installed java 7 update 65 JRE, do I need JDK? – Anishka Jitendrabhai Vaghani Aug 03 '14 at 08:11
  • I just edited my answer. Do a refresh :) you need to set the symbolic link aka JAVA_HOME (in your case this is not an additional step it seems). Downloading and installing JDK is useful for Java development anyway. I suggest you use JDK 1.7.0-65, right! – MWiesner Aug 03 '14 at 08:14
  • To use JDK 1.8 is also a valid approach :) - just replace version strings - should also work as described above – MWiesner Aug 03 '14 at 08:40
  • Also keep in mind to use a 64bit version of Eclipse on MacOS (http://www.eclipse.org/downloads/?osType=macosx) when using a 64bit JDK Installation – MWiesner Aug 03 '14 at 08:45
  • Yes I already have 64 bit version of Eclipse. So I installed the JAVA JDK and it works without the Java 6 (Apple version). I'm really happy now, finally I can start coding! Thank you :) – Anishka Jitendrabhai Vaghani Aug 03 '14 at 09:34
  • Need to deal with System Integrity Protection (SIP) if following this answer. Installing JDK work without issue. – Oleksiy Ivanov Jan 16 '18 at 03:36
1

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>
rasolog
  • 306
  • 1
  • 11
  • I downloaded Java 'jdk-8u51-macosx-x64' then had to edit this file. This is on OS X Yosemite 10.10.4 – lukik Aug 07 '15 at 17:35
1

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).

Ryan Schraub
  • 31
  • 1
  • 5
0

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

Community
  • 1
  • 1
VenomVendor
  • 15,064
  • 13
  • 65
  • 96
0

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.

VinayBS
  • 389
  • 5
  • 19
0

Try this

https://gist.github.com/johan/10590467

You might have to disable SIP and reenable it.

Community
  • 1
  • 1
Vikas
  • 1,900
  • 1
  • 19
  • 20
0

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!

Souvik
  • 865
  • 6
  • 8
-1

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/

spoko
  • 783
  • 1
  • 10
  • 24
-1
  1. Install the updated JDK
  2. Update the environment variables: here's how
  3. If still not working uninstall the older JDK
ranbuch
  • 1,584
  • 16
  • 14
-2

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

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.

Zong
  • 6,160
  • 5
  • 32
  • 46
John
  • 527
  • 1
  • 4
  • 4