139
votes

Eclipse is unable to open, have used eclipse before and has open before without a problem. Now I keep getting the following error message:

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:

Have gotten eclipse to open and work on projects before and won't open.

Here is a screen shot of what I keep getting:

enter image description here

27

27 Answers

187
votes

You can explicitly tell Eclipse where to find it. Open eclipse.ini and add the following lines to the top of the file:

-vm
/absolute/path/to/jre6/bin

Update: I just nailed down the root cause on my own Windows machine. The GlassFish installer complained with exactly the same error message and after digging in GlassFish forums, the cause was clear: a corrupt JRE install on a Windows machine. My JRE came along with the JDK and the Java 6 JDK installer didn't install the JRE properly somehow. A DLL file was missing in JDK's JRE installation. After I reinstalled the standalone JRE from http://java.com, overwriting the old one, the GlassFish installer continued and also Eclipse was able to start flawlessly without those two lines in eclipse.ini.

19
votes

It usually is because:

  • you indicated the wrong jvm path in your -vm argument: see this SO question for an concrete example.
  • the eclipse.ini got corrupted somehow (if it hasn't been modified, this isn't it, but if setting a jvm path doesn't work, ... I would replace the eclipse.ini by one coming from a fresh installation just to be sure)
  • the java which eclipse search by default is no longer accessible (because the $PATH is no longer up-to-date)

More details on the wiki page "Finding a VM, Using JNI Invocation or Executing Java"

No -vm specified

When no -vm is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path.
If java is found in either location, then we look for a jvm shared library (jvm.dll on window, libjvm.so on *nix platforms) relative to that java executable.

  • If a jvm shared library is found we load it and use the JNI invocation api to start the vm.
  • If no jvm shared library is found, we exec the java launcher to start the vm in a new process.

As mentioned in "FAQ How do I run Eclipse?":

Eclipse DOES NOT consult the JAVA_HOME environment variable.

So I would check your $PATH, starting by n new shell sesion (whatever your OS is), typing 'java -version' to see if it still returns anything.

16
votes

I got this problem because i uninstalled the jdk version 13 and reinstall the jdk version 8

Even though i have updated the path variables eclipse still pick the old configuration.

You need to edit the eclipse.ini file which is in your folder where eclipse.exe is placed.

enter image description here

Just update this file with the latest path so eclipse can pick it up

enter image description here

12
votes

Copy javaw.exe from C:\Program Files\Java\jre1.8(or)1.6(or)1.7\bin

enter image description here

and paste it inside Eclipse folder where eclipse.exe is there. That's all.

enter image description here

10
votes

I had the same problem and the issue was that I had a 32 bit version of Eclipse running on my 64 bit machine and it wanted the 32 bit version of JRE.

I changed Program Files to Program Files (x86) in the eclipse.ini file like so:

-VM
C:Program Files (x86)\Java\jre6\bin

and that solved the problem.

You may want to just install the 64 bit Eclipse, but this will take care of the error.

10
votes

Here is how I fixed mine:

  1. find the location where your jre is installed. in my case, it was located at C:\Program Files\Java\jdk1.7.0_10

  2. copy the jre folder and paste it where your eclipse files are located (where eclipse.exe is located).

when you download eclipse, you get a .zip package containing eclipse.exe and all the other files needed to run eclipse but it is missing the jre files. so all you need to do is to find where jre folder is located on your hard drive and add it to the rest of the eclipse package.

7
votes

Did you install Java via the java.com web browser auto install? If so, then that's your problem! You need to to the "manual" install: http://www.java.com/en/download/manual.jsp

It's just a matter of having the correct match of 32-bit Eclipse/32-bit Java or 64-bit Eclipse/64-bit Java. Many 64-bit Windows have 32-bit browsers and the latter is the version of Java that the auto-installer will provide - not what the 64-bit Eclipse wants.

5
votes

Make sure the install path of JDK is in your Path variable in Windows.

3
votes

Is so simple,only add your java path for example:

C:\Program Files\Java\jdk1.8.0_121\bin

in PATH system variable

3
votes

I have faced the similar issue earlier with Eclipse and STS IDE'S

  • Please check weather JDK/JRE is available or not in your machine. If not please install JDK and setup the environment variables.
  • Even after step 1, if you are still facing the issue then it's time to set the vm argument in eclipse.ini or sts.ini in the following way.
-vm 
C:Program Files (x86)\Java\jre8\bin
2
votes

I also had same problem when developing android applications using eclipse IDE. I solved it by removing all the java installations (I had java 6 and 7 both) and re-install only jdk 7.

2
votes

adding -vm C:/Program Files/Java/jdk1.6.0_29/bin/javaw.exe to the .ini file helped me.

2
votes

I got this fixed by doing the below steps,

1)

  1. The eclipse finds the JAVA executables from 'C:\ProgramData\Oracle\Java\javapath'
  2. The folder structure will contain shortcuts to tenter image description herehe below executables, i. java.exe ii. javaw.exe iii. javaws.exe
  3. For me the executable paths were pointing to my (ProgramFiles(x84)) folder location
  4. I corrected it to Program Files path(64 bit) and the issue got resolved

Please find the screenshot for the same.

2
votes

Just to add on top of other answers:

Windows Users: You can give the PATH to JRE in eclipse.ini separated by '/' or '\'. It doesn't matter. Eclipse will pick it anyway. For example, in my windows system, either of the paths is fine (after -vm of course):

C:/Program Files/Java/jre1.8.0_181/bin or C:\Program Files\Java\jre1.8.0_181\bin

1
votes

Change the vm value in eclipse.ini file with the correct path to your JDK something like this,

-vm /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home/bin

Path to eclipse.ini looks to me something like this,

/Users/tomcat/eclipse/jee-2018-09/Eclipse.app/Contents/Eclipse

1
votes

This sometimes happen if you remove Java from your path variables. To set the PATH variable again, add the full path of the jdk\bin directory to the PATH variable. Typically, the full path is:

C:\Program Files\Java\jdk-11\bin

To set the PATH variable on Microsoft Windows:

  1. Select Control Panel and then System.
  2. Click Advanced and then Environment Variables.
  3. Add the location of the bin folder of the JDK installation to the PATH variable in system variables.
0
votes

I had this problem too on a win7 machine. I wanted to update the jre with a jdk. So i deleted the jre folder and downloaded and unzipped the new jdk. The issue was i manually deleted the jre folder, when instead i should've uninstalled it. This leaves a bunch of registry entries that still point to the old jre. Somehow eclipse still wants to use the old jre. I couldn't uninstall the old java vm, i kept getting this error:

Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor

So i had to use this MS utility to fix the uninstall:

http://support.microsoft.com/kb/2438651/

Then i had to install again the vm. I installed to the same location the original one was at, to avoid losing another hour! After that eclipse started correctly.

Julio

0
votes

I just had this problem and fixed it this way. I noticed the error message has jre in it not jre6 or jre7, so i copied jre6 from program files to eclipse folder then renamed it from jre6 to jre, then it worked :p

0
votes

Newb move on my part, but I had installed just the JRE instead of JDK. Installed JDK and my problem went immediately away.

0
votes

I had this problem and it was due to my windows machine playing up. I went into control panel -> system -> advanced - environment variables.

I edited the PATH variable (which was already correctly set up), changed NOTHING, clicked OK to come back out of the screens.

Then eclipse worked. No idea why, except because windows. Hopefully this may help someone.

0
votes

I had this issue; I fixed it by going to

Computer-->Properties-->Advanced Settings-->Environmental Variables

In the System Variables find the variable named PATH.
-->Select Edit -->At the very end of the Path Variable, put a ";" then add your path of your JDK and put \bin\ at the end

Should be fixed.

Example:

System Variable-

C:\Program Files (x86)\Common Files.......HP\LeanFT\bin

JDK path-

C:\Programs Files\Java\jre1.8.0_121

Final Path -

C:\Program Files (x86)\Common Files.......HP\LeanFT\bin;C:\Programs Files\Java\jre1.8.0_121\bin\

Sources: https://www.java.com/en/download/help/path.xml

0
votes

Its simple. JDK bin directory or JRE bin directory should be in path variable Example : Java Installed directory: Assume your java installed in 'C:\Program Files\java\Jdk1.8.0_144' directory Now you can find bin directory in 'C:\Program Files\java\Jdk1.8.0_144\bin'

Navigate to user's environment variable

Control Panel --> User Accounts --> User Accounts --> Change my environment variables

In popup click Path under User variables for section Click Edit... button and another popup will appear

Click New button and enter C:\Program Files\java\Jdk1.8.0_144\bin

Click OK button and again OK button in Environment variables popup.

Now you can open your eclipse without error

0
votes

I found a solution wherein the Eclipse.ini the location was the old version of Java, and after updating the new version of java the location of -vm

C:\Program Files\Java\jre1.8.0_201\bin

was same so I had to change the directory to my new version of Java.

So solution is to just open the most updated Java version and copying its directory path and replacing it in the Eclipse.ini file.

0
votes

Moderately future proof example for Linux-like systems. Assuming javac installed and on your path.

./eclipse -vm dirname $(readlink -f $(which javac))

This will find the directory where javac is installed, and pass as vm argument to eclipse.

0
votes

If on Linux (ex: Ubuntu 18), try installing (or reinstalling in your case?) default-jre, as follows:

sudo apt update
sudo apt install default-jre

I had the same error when just trying to run the Eclipse installer (./eclipse-inst) on a fresh Eclipse download just now, and the installer wouldn't even run! Installing default-jre solved it!

Source:

0
votes

In my case I had edited the eclipse.ini for a different purpose to include -vm parameter. That was causing the failure. I removed the -vm and following line where I had included \bin and that fixed the problem.

-1
votes

C:\Program Files\Java\jre1.8.0_221\bin worked for me