4
votes

I opened Eclipse:

Open Eclipse

I got this Error:

Eclipse Error

My OS:

Mac OS

Text:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse.

No Java virtual machine was found after searching the following locations: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin

3
Your installed Java version is jdk1.8.0_131, not jdk1.8.0_121.Mincong Huang
How do I fix it so that Eclipse looks for jdk1.8.0_131?Michael Lafayette
How did you trigger this message?nitind
I opened Eclipse.Michael Lafayette
I'm not as familiar with mac, but perhaps the environment path, or some other environment variable could have the old version such as JAVA_HOME? You may be able to set it by the java control panel: java.com/en/download/help/mac_controlpanel.xmlPaul T.

3 Answers

5
votes

Change "jdk1.8.0_121" to "jdk1.8.0_131" in eclipse.ini

eclipse.ini

3
votes

In something version of eclipse the path for eclipse.ini: /Eclipse.app/Contents/Eclipse/eclipse.ini

put this:

/Library/Java/JavaVirtualMachines/VERSION.jdk/Contents/Home/jre/bin/
2
votes

When you encounter this error, most probably you or system has updated the Java and the path for the Java virtual machine has changed. Updating the VM path as other answers work but you will have to repeat the same exercise again when Java version updates again. Following is the solution I use to get out of this cycle.

  1. Open eclipse package. Open package contents
  2. Open eclipse.ini file in /Content/Eclipse folder
  3. Open terminal and type ls -l /usr/bin/java
  4. Replace -vm parameter with the symlink from the terminal. It would most probably be /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands