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

Viewed 7601

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

4 Answers

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/

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

Maybe tweaking the Java path (in my case it was the Java version) in /Applications/Eclipse.app/Contents/info.plist solves the problem.

Related