Eclipse - no Java (JRE) / (JDK) ... no virtual machine
Solution 1
Eclipse will by default try to launch with the default "java.exe
" (the first one referenced by your PATH
)
Three things to remember:
- "Installing" a JRE or a JDK can be as simple as unzipping or copying it from another computer: there is no special installation steps, and you can have as many different JVM versions (1.4, 5.0, 6.0...) as you want, "installed" (copied) almost anywhere on your disk.
- I would recommend to always run Eclipse with the lastest JRE possible (to benefit from the latest hotspot evolutions).
You can:
- Reference that exact JRE path in your eclipse.ini.
-
Copy any JRE of your in your <eclipse>/jre directory.
In both cases, no
PATH
to update.
- The JVM you will reference within your Eclipse session is not always the one used for launching Eclipse because:
- You only need a JRE to launch Eclipse, but once Eclipse launched, you should register a JDK for your projects (especially for Java sources and debugging purposes, also in theory for compilation but Eclipse has its own Java compiler) Note: You could register just a JRE within Eclipse because it is enough to run your program, but again a JDK will allow for more operations.
- Even though the default registered Java in Eclipse is the one used to launch the session, you can want to register an older SDK (including a non-Sun one) in order to run/debug your programs with a JRE similar to the one which will actually be used in production.
June 2012, jmbertucci comments:
I'm running Windows 7 64-bit and I had the 32-bit JRE installed. I downloaded Eclipse 64-bit which looks for a 64-bit JRE. Because I didn't have the 64-bit JRE it threw the error, which makes sense.
I went to the Java manual install page (which was not as directly accessible as you'd like) and installed the 64-bit version. See "Java Downloads for All Operating Systems". That was all I needed.
April 2016: Steve Mayne adds in the comments:
I had to edit the
eclipse.ini
file to reference the correct Java path - Eclipse doesn't use the environmentPATH
at all when there is a value ineclipse.ini
.
Solution 2
Just copy this file :
c:/Program Files/Java/jre(5,6,7..any version)/bin/javaw.exe
to Eclipse Folder
*note only tested for Windows
Solution 3
All the other answers about setting only the JAVA_HOME
are not entirely right. Eclipse does namely not consult the JAVA_HOME
. Look closer at the error message:
...in your current PATH
It literally said PATH
, not JAVA_HOME
.
Rightclick My Computer and choose Properties (or press Winkey+Pause), go to the tab Advanced, click the button Environment Variables, in the System Variables list at the bottom select Path
(no, not Classpath
), click Edit and add ;c:\path\to\jdk\bin
to the end of the value.
Alternatively and if not present, you can also add JAVA_HOME
environment variable and make use of it in the PATH
. In the same dialogue click New and add JAVA_HOME
with the value of c:\path\to\jdk
. Then you can add ;%JAVA_HOME%\bin
to end of the value of the Path
setting.
Solution 4
Open up Windows' System Properties from the control panel and hunt down the environment variables section:
- Add a JAVA_HOME entry pointing to the directory where the JDK is installed (e.g. C:\Program Files\Java\jre6)
- Find the Path entry and add the following onto the end ;%JAVA_HOME%\bin
- OK the changes
- Restart eclipse so that it is aware of the new environment
Most Java tools will now be able to find your Java installation either by using the JAVA_HOME environment variable or by looking for java.exe / javaw.exe in the Path environment variable.
Solution 5
If you download the 64 bit version of Eclipse; it will look for the 64 bit version of JRE. If you download the 32 bit version of Eclipse; it will look for the 32 bit version of JRE
What I did was to install the both the 32 and 64 bit version of JRE. You can get that from the SUN Oracle site. The JAVA site seems to automatically install the 32 bit version of Java. I guess that's because of the web browser.
Related videos on Youtube
Wallter
Updated on May 26, 2020Comments
-
Wallter almost 4 years
I am trying to get Eclipse v3.5 (Galileo) to re-run on my computer - I have run it before with no problems, but now I keep getting this error:
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: C:\eclipse\jre\javaw.exe javaw.exe in your current PATH
I've just done a fresh install of both the JDK and the SDK.
I have Windows 7 (x64).
What's up with this? How do I fix it?
I can't run any of the ipconfig / tracert / or ping.
-
user85421 over 14 years
Java Runtime Environment
is JRE not SDK... -
matbrgz almost 14 yearsInstall a JRE - this gives a javaw.exe in your path. JDK's doesn't.
-
matbrgz almost 14 years@Carlos, each JDK brings a private JRE.
-
user85421 almost 14 years@Thorbjørn: and what is the point? I know that and also that JDK also brings a public JRE. I wrote that "Java Runtime Environment is not SDK" but you have to read the original post (before being edited on January 11th) to understand why I wrote it: "A java Runtime Environment (SDK) or..."
-
Rajaraman Subramanian about 10 yearsIf you have recently installed JDK in another path after you have installed Eclipse then you may face this issue. This is because the eclipse hard code the JDK path in eclipse.ini when it is setup for the first time. Just change the correct JDK path in eclipse.ini. That should solve this error.
-
Bugs Bunny about 9 yearsNavigate to
C:\Program Files\Java\jreX\bin
and copyjavaw.exe
toC:\Program Files\sts-bundle\sts-X.X.X.RELEASE
. If there is nojavaw.exe
in thebin
folder, install Java JRE. -
Stphane almost 9 yearsI encountered this issue running Eclipse Keplerx86 on W8.1. Because I'm tidy I just did not want to copy the jre folder inside the eclipse directory, I managed to launch eclipse after reinstalling all jre and making sure paths to java instances did not contain any space. Then I edited the
eclipse.ini
file (in eclipse root directory) and updated the argumentopenfile -vm "C\:tools\java\..."
path. »Like shown here«. ~I hope it will help and save headaches~ -
Accountant م about 4 yearsI installed another JRE after creating the eclipse woekspace, so I created a new workspace and it detected the new JRE
-
-
Wallter over 14 yearsI followed these instructions: wso2.org/project/wsas/java/2.0-beta/docs/setting-java-home.html but to no avail
-
Topher Fangio over 14 yearsI hate to say it...but have you restarted?
-
matbrgz over 14 yearsRestarting is not necessary to install Java.
-
user85421 over 14 yearsneither is JAVA_HOME necessary. It is the PATH which is used to find the javaw.exe. (JAVA_HOME is used by some other applications like ant, so it's not wrong setting it anyway)
-
Wallter over 14 yearsWhen I added name:JAVA_HOME value: "C:\Program Files (x86)\Java\jdk1.6.0_14;%JAVA_HOME%\bin" I still get the same error
-
Wallter over 14 yearsIt didn't work :) the data of the environment name: Path --- value: C:\Program Files (x86)\Java; C:\Program Files (x86)\Java\jdk1.6.0_14\bin
-
Wallter over 14 yearsYes I tried to add the android add-on. But no (like Topher Fangio said,) I can't start Eclipse now.
-
Wallter over 14 yearslike this: "C:\Program Files (x86)\Java; C:\Program Files (x86)\Java\jdk1.6.0_14\bin" ? - it still didn't work :)
-
Wallter over 14 yearsI re-installed it (it even asked if i wanted to reinstall it) with no avail. ( I did both the Google Chrome plugin 14 - or something like that && the Firefox )
-
matbrgz over 14 yearsYou went to java.com? Not javasoft.com?
-
BalusC over 14 yearsPaths with spaces needs to be enclosed in quotes.
-
Csaba_H over 14 yearsBTW, you should use jdk1.6.0_16 or later. Using jdk 1.6.0_14 you cannot use breakpoints correctly in Eclipse: bugs.eclipse.org/bugs/show_bug.cgi?id=279137
-
Wallter over 13 yearsI don't have the problem anymore - but this seems like a good solution and makes sense - it would be interesting to test this with other 64bit browsers...
-
Wallter over 13 yearsAs ladookie said the problem most likely was the browser running bad code on Java's web site and getting the wrong version of JAVA...
-
Wallter over 13 yearsSee but you were using Windows 7 x86 where I was using x64 --- as others have stated this problem may have been a glych on SUN's part in their programing of how their web page 'detects the version' (i.e. x64 or x86) you should use
-
Tim over 13 yearsCorrection, I was using Windows 7 x64
-
laketuna almost 13 yearsspeedbaron is completely right here. If you're modifying your environmental variable PATH, make sure you put the path of the correct version. My Windows 7 64-bit system had a 32-bit JRE installed (don't know why), so I installed the 64-bit version and added to PATH the new directory. It seems to work well now.
-
jmbertucci almost 12 yearsThis question/answer is slightly old but I was running into this issue so I'll post my notes. I'm running Win7 64bit and I had the 32bit JRE installed. I downloaded Eclipse 64bit which looks for a 64bit JRE. Because I didn't have the 64bit JRE it threw the error, which makes sense. I went to the Java manual install page (which was not as directly accessible as you'd like) and installed the 64bit version. java.com/en/download/manual.jsp That was all I needed.
-
VonC almost 12 years@Nuktu: I have added jmbertucci's comment to the answer
-
VonC almost 12 years@jmbertucci: thank you for your notes. I have added them to the answer for more visibility.
-
Akhil Jain over 11 yearsmy path was configured perfectly configured before, Borland compiler edited the path field and replace the java path with its own path, now its Fixed, thnks!!!
-
matbrgz about 11 years@jmbertucci you should also have been able to use a 32-bit Eclipse.
-
hexicle almost 11 yearsI had the same problem and installing 64bit Java solved the problem.
-
informatik01 almost 11 years@BalusC Actually, no need to enclose paths in quotes when configuring PATH environment variables on Windows. Just delimiting them with semicolon (
;
) is enough. -
styfle almost 11 yearsThis was my problem. Note that windows installs 64 bit to
C:\Program Files\Java
and 32 bit toC:\Program Files (x86)\Java
. -
triplebig about 10 yearsthis is the answer that solves it. after a couple of hours digging through, to those who have the same problem, what you need is: 1) make sure everything is 64-bit. Should automatically install in "program files", NOT "program files(x86)". 2) Write the -VM to the bin folder that the other answers have. 3) Set the path as this guy said. Nothing will ever happen if you cannot run java from the command line. 4) rejoice
-
Noha Kareem almost 10 yearsI was searching for a simple solution as this answer but it didn't work for me, in case someone has a similar situation, changing the vm directory in the eclipse.ini file might help.
-
Susie over 9 yearsIf nothing works, just delete your eclipse and reinstall it. Doing so worked for me.
-
CuriousMarc over 9 yearsDidn't work for me, gave me Error: opening registry key 'Software\Javasoft\Java Runtime Environment'. I had to copy the whole jre7 (in my case) folder into the Eclipse directory, and rename it jre. Then it worked.
-
Heri over 9 yearsReferencing JAVA_HOME in the path variable requires embedding it: %JAVA_HOME%\bin
-
Heri over 9 yearsI vote for this answer to be the correct one. Do not rely on the windows path variable because it gets changed in nearly every update. E.g. a chrome (32bit on a 64 bit machine) java update replaces the systemwide 64 bit JVM by a 32 bit JVM. Note also that this entry has to be the last one in the eclipse.ini, otherwise it does not work. And - as otherwise stated - the JAVA_HOME variable is NOT evaluated by eclipse.exe. Please edit your answer accordingly.
-
Daniel Handojo about 8 yearsediting the ini file did it for me. It was looking in the wrong folder
-
Steve Mayne about 8 yearsThis is the solution that worked for me - thanks Lucky. Eclipse loads the JRE referenced in the ini file, so the accepted answer is incorrect in suggesting it looks at the env PATH.
-
Steve Mayne about 8 years@VonC I had to edit the eclipse.ini file to reference the correct java path - Eclipse doesn't use the environment PATH at all when there is a value in eclipse.ini
-
VonC about 8 years@SteveMayne Interesting, thank you. I have included your comment in the answer for more visibility.
-
Arthur Zhixin Liu about 7 yearsFor somebody fails, try to copy the jre folder to the eclipse folder.
-
Mindsect Team about 7 years@NohaKareem your advice was the closest for me. Unfortunately, my 'jre' folder contained only 'lib', so copying over the Java 'jdk' folder (although larger at 350MB, but had an internal 'bin' folder) and renaming it 'jre' worked. Thanks.
-
BuvinJ about 5 yearsThis is the best answer, since it directly resolves the actual problem. Eclipse is looking for a path per a specific parameter, and that value is wrong... so correcting the value fixes the issue.
-
Guy Avraham about 5 yearsFor me (Windows 10 64 bit + Eclipse 4.10) the trick was to add, in addition to the
JAVA_HOME
environment variable, theJRE_HOME
variable, which was set to the location of thejavaw.exe
location (which is probably always the bin folder of the JDK which is installed). -
DiamondDrake over 4 yearsHaving both 32 and 64 bit java installed but 32bit java in path, trying to open a 64bit eclipse will fail, putting the 64bit javaw file next to exclipse makes it work.