我正在尝试让Eclipse v3.5 (Galileo)在我的计算机上重新运行-我以前运行过,没有问题,但现在我一直得到这个错误:

要运行Eclipse,必须提供Java运行时环境(JRE)或Java开发工具包(JDK)。在搜索以下位置后没有发现Java虚拟机: C: \ eclipse \ jre \ javaw.exe javaw.exe在当前路径

我刚刚重新安装了JDK和SDK。

我用的是Windows 7 (x64)。

这是怎么回事?我该怎么解决呢?

我不能运行任何ipconfig / tracert /或ping。


当前回答

尝试将JAVA_HOME设置为正确的文件夹。谷歌用于设置Windows环境变量。

其他回答

首先感谢悠悠提出的解决方案!我尝试了YouYou (https://stackoverflow.com/a/14464653/801919)的回答。起初,它对我不起作用。以下是我需要采取的步骤:

Initially, I did not have Java installed on my new machine. So, I had to install that (downloaded from: http://java.com/en/download/manual.jsp). I am running 64-bit OS. But, while downloading, I got the message which could help me in choosing which version of Java to download: Choose the 32-bit download to use with a 32-bit browser. Hence, I downloaded 32-bit version. Then, I followed the procedure mentioned in https://stackoverflow.com/a/14464653/801919, hoping to get the solution. I got some other error: Java was started but returned exit code=13 Then, I installed 64-bit version of Java. Copied javaw.exe from that version.

...Eclipse开始工作了!!Yaay !

只需在环境变量中添加JRE PATH FOR Ex: C:\Program Files\Java\jre5\bin 把“;”放在每条路径之间。然后点击eclipse.exe,它将工作.....

Eclipse将在默认情况下尝试使用默认的“java.exe”(由PATH引用的第一个)启动。

要记住三件事:

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


2012年6月,jmbertucci评论道:

我运行的是64位的Windows 7,并且安装了32位的JRE。 我下载了一个64位的Eclipse 64位JRE。 因为我没有64位JRE,所以它抛出了错误,这是有道理的。 我转到Java手动安装页面(不像你想的那样直接访问),安装了64位版本。参见“适用于所有操作系统的Java下载”。 这就是我所需要的。


2016年4月:史蒂夫·梅恩在评论中补充道:

我必须编辑eclipse.ini文件以引用正确的Java路径- 当Eclipse .ini中有值时,Eclipse根本不使用环境PATH。

进入Eclipse—>Windows—>Preferences 然后进入“已安装JRE” 然后点击添加,然后添加新的JDK路径(JDK安装在你机器上的路径)

然后点击确定

它应该映射到eclipse和work。

注意:只有你映射的最新版本的JDK才会显示在已安装的JRE中,类型为标准,名称为默认。

谢谢。

您得到这个错误的原因是因为eclipse需要JRE来启动,而它找不到JRE。它搜索的第一个位置是当前目录,然后是eclipse.ini文件,最后是系统路径。因此,如果它不能通过这三个地方中的任何一个找到正确的jvm(位版本不同),它就会停止运行

推荐的方法是编辑eclipse.ini文件,并告诉eclipse在哪里查找vm/jre,通过在文件中包含这一行:

虚拟机 [Java .exe的路径](通常在“C:\Program Files\Java\jre7\bin”下)

注:要编辑eclipse.ini,您可能需要移动它,编辑然后粘贴回来

来源:维基百科