Eclipse:找不到Java 2 Runtime Environment

时间:2022-07-17 17:06:58

I just installed Eclipse 3.5. Before I could install the Android Plugin I needed to install a Java jdk, which I did. After restart Im not able to start Eclipse anymore, because I receive the following error:

我刚刚安装了Eclipse 3.5。在我安装Android插件之前,我需要安装Java jdk,我做了。重启后我不能再启动Eclipse,因为我收到以下错误:

Error: could not finde Java 2 Runtime Environment

错误:无法找到Java 2 Runtime Environment

The weired thing is, that now I cant even open my other Eclipse Installations, that I use for PHP Programming. Any suggestions?

经历的是,现在我甚至无法打开我用于PHP编程的其他Eclipse安装。有什么建议么?

Update:

更新:

This is my eclipse.ini:

这是我的eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.0.200.v20090519
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx256m

11 个解决方案

#1


6  

You can explicitely tell your eclipse session which jdk/jre you want it to start with adding the following in your eclipse.ini:

您可以通过在eclipse.ini中添加以下内容来明确地告诉您的eclipse会话,您希望它从哪个jdk / jre开始:

-vm
c:/your/jre/bin/javaw.exe

-vm c:/your/jre/bin/javaw.exe

For more info on how to startup your eclipse refer here

有关如何启动eclipse的更多信息,请参阅此处

#2


5  

I had a similar problem, with exception that Java was installed successfully. Once I added c:/my-path-to-java/jre/bin to PATH (system environment variable), Eclipse started successfully.

我遇到了类似的问题,但Java安装成功除外。一旦我将c:/ my-path-to-java / jre / bin添加到PATH(系统环境变量),Eclipse就成功启动了。

#3


3  

Change the PATH environment variable from something like

从类似的东西更改PATH环境变量

...;%SystemRoot%\System32;...;C:\Program Files\Java\jdk1.7.0_17\bin;...

to something like

喜欢的东西

...;C:\Program Files\Java\jdk1.7.0_17\bin;...;%SystemRoot%\System32;...

#4


2  

Check your path variable from Computer's System Properties Environment Variables JAVA_HOME to ocorrect path to your jdk installation

检查您的路径变量从计算机的系统属性环境变量JAVA_HOME到您的jdk安装的正确路径

#5


1  

Wonder if the Java install might be corrupt. Can you run the following on the Run prompt and paste what you get in code tags:

不知道Java安装是否可能已损坏。您可以在“运行”提示符上运行以下命令并粘贴代码标记中的内容:

dir /d /s "%JAVA_HOME%" > "%HOMEPATH%\java2.txt" && notepad "%HOMEPATH%\java2.txt"

#6


1  

It makes sense that your PHP eclipse won't start either. Eclipse runs on java itself. Probably it cannot find the JRE.

你的PHP eclipse也不会启动是有意义的。 Eclipse在java本身上运行。可能它找不到JRE。

so I see two possibilities:

所以我看到两种可能性:

  • The JRE is corrupt and you should reinstall it
  • JRE已损坏,您应该重新安装它
  • Eclipse is getting confused by the 2 jre (unlikely to me) and you need to point it to the right one (as suggested by Dimistrisli).
  • Eclipse被2 jre(我不太可能)弄得很困惑,你需要把它指向正确的(正如Dimistrisli建议的那样)。

#7


1  

I had the same issue. Eclipse (3.7) worked just fine for a while with JDK 6, and then I installed JRE 5 (please don't ask me why)

我遇到过同样的问题。 Eclipse(3.7)使用JDK 6工作得很好,然后我安装了JRE 5(请不要问我为什么)

This eclipse wiki page, which seems up to date, states that:

这个日食维基页面似乎是最新的,它指出:

If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable

如果在eclipse / jre目录中安装了JVM,Eclipse将使用它;否则启动器将查询eclipse.ini文件和系统路径变量。 Eclipse不会参考JAVA_HOME环境变量

And indeed, I did not change JAVA_HOME so that couldn't be it. However, at the bottom of the same wiki page, someone added:

事实上,我并没有改变JAVA_HOME,所以不可能。但是,在同一个wiki页面的底部,有人添加了:

A comment on the JVM search order (on Windows) - My testing (Windows 7, Eclipse 3.4.1) shows that Eclipse also looks for a JVM in the registry, in my case HKLM\Software\Wow6432Node\JavaSoft\Java Runtime Environment

关于JVM搜索顺序的评论(在Windows上) - 我的测试(Windows 7,Eclipse 3.4.1)显示Eclipse也在注册表中查找JVM,在我的例子中是HKLM \ Software \ Wow6432Node \ JavaSoft \ Java Runtime Environment

So I found the mentioned registry entry, which now had the value of "1.5" and changed it to "1.6", then restarted my PC (windows 7), and voila - Eclipse went back alive.

所以我找到了提到的注册表项,现在它的值为“1.5”,并将其更改为“1.6”,然后重新启动我的PC(Windows 7),并且瞧 - Eclipse回归活着。

I agree that adding "-vm" might fix this, although it didn't seem to work for me (maybe I didn't add it in the right place/format). But IMO, the registry fix was the better one in my case. After restarting my computer and seeing Eclipse was back to normal, I uninstalled JRE 5 (through "Add or remove programs") just to tie up loose ends.

我同意添加“-vm”可能会解决这个问题,虽然它似乎对我不起作用(也许我没有将它添加到正确的位置/格式)。但IMO,在我的情况下,注册表修复是更好的。重新启动计算机并看到Eclipse恢复正常后,我卸载了JRE 5(通过“添加或删除程序”)只是为了解决松散的问题。

#8


1  

In my case installing the most recent JRE worked well: http://www.oracle.com/technetwork/java/javase/overview/index.html

在我的情况下安装最新的JRE运行良好:http://www.oracle.com/technetwork/java/javase/overview/index.html

#9


1  

I had the same problem when I recently installed JDK 7 Update 9. My eclipse did not open and when I run "java -version" from CMD, it did not work either. I had PATH variable set to the correct bin directory.

我最近安装JDK 7 Update 9时遇到了同样的问题。我的eclipse没有打开,当我从CMD运行“java -version”时,它也没有用。我将PATH变量设置为正确的bin目录。

Anyways, eventually when I set JAVA_HOME to the new installation directory, eclipse started fine. Not sure what is the problem with JDK 7 Update 9.

无论如何,最终当我将JAVA_HOME设置到新的安装目录时,eclipse就开始了。不确定JDK 7 Update 9有什么问题。

#10


0  

Make sure everything is setup correctly under "installed JREs" under the Eclipse preferences.

确保在Eclipse首选项下的“已安装的JRE”下正确设置了所有内容。

#11


0  

The simple solution that worked for me, since other resolution required admin privilege is executing the below command from command prompt

这个简单的解决方案对我有用,因为其他解析所需的管理员权限是从命令提示符执行以下命令

eclipse -vm C:\Java\jdk1.7.0_72\bin\javaw

eclipse -vm C:\ Java \ jdk1.7.0_72 \ bin \ javaw

Also, to make the eclipse shortcut work by editing the shortcut.Append -vm C:\Java\jdk1.7.0_72\bin\javaw in the target section

此外,通过编辑快捷方式使eclipse快捷方式工作。目标部分中的-Agnd -vm C:\ Java \ jdk1.7.0_72 \ bin \ javaw

#1


6  

You can explicitely tell your eclipse session which jdk/jre you want it to start with adding the following in your eclipse.ini:

您可以通过在eclipse.ini中添加以下内容来明确地告诉您的eclipse会话,您希望它从哪个jdk / jre开始:

-vm
c:/your/jre/bin/javaw.exe

-vm c:/your/jre/bin/javaw.exe

For more info on how to startup your eclipse refer here

有关如何启动eclipse的更多信息,请参阅此处

#2


5  

I had a similar problem, with exception that Java was installed successfully. Once I added c:/my-path-to-java/jre/bin to PATH (system environment variable), Eclipse started successfully.

我遇到了类似的问题,但Java安装成功除外。一旦我将c:/ my-path-to-java / jre / bin添加到PATH(系统环境变量),Eclipse就成功启动了。

#3


3  

Change the PATH environment variable from something like

从类似的东西更改PATH环境变量

...;%SystemRoot%\System32;...;C:\Program Files\Java\jdk1.7.0_17\bin;...

to something like

喜欢的东西

...;C:\Program Files\Java\jdk1.7.0_17\bin;...;%SystemRoot%\System32;...

#4


2  

Check your path variable from Computer's System Properties Environment Variables JAVA_HOME to ocorrect path to your jdk installation

检查您的路径变量从计算机的系统属性环境变量JAVA_HOME到您的jdk安装的正确路径

#5


1  

Wonder if the Java install might be corrupt. Can you run the following on the Run prompt and paste what you get in code tags:

不知道Java安装是否可能已损坏。您可以在“运行”提示符上运行以下命令并粘贴代码标记中的内容:

dir /d /s "%JAVA_HOME%" > "%HOMEPATH%\java2.txt" && notepad "%HOMEPATH%\java2.txt"

#6


1  

It makes sense that your PHP eclipse won't start either. Eclipse runs on java itself. Probably it cannot find the JRE.

你的PHP eclipse也不会启动是有意义的。 Eclipse在java本身上运行。可能它找不到JRE。

so I see two possibilities:

所以我看到两种可能性:

  • The JRE is corrupt and you should reinstall it
  • JRE已损坏,您应该重新安装它
  • Eclipse is getting confused by the 2 jre (unlikely to me) and you need to point it to the right one (as suggested by Dimistrisli).
  • Eclipse被2 jre(我不太可能)弄得很困惑,你需要把它指向正确的(正如Dimistrisli建议的那样)。

#7


1  

I had the same issue. Eclipse (3.7) worked just fine for a while with JDK 6, and then I installed JRE 5 (please don't ask me why)

我遇到过同样的问题。 Eclipse(3.7)使用JDK 6工作得很好,然后我安装了JRE 5(请不要问我为什么)

This eclipse wiki page, which seems up to date, states that:

这个日食维基页面似乎是最新的,它指出:

If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable

如果在eclipse / jre目录中安装了JVM,Eclipse将使用它;否则启动器将查询eclipse.ini文件和系统路径变量。 Eclipse不会参考JAVA_HOME环境变量

And indeed, I did not change JAVA_HOME so that couldn't be it. However, at the bottom of the same wiki page, someone added:

事实上,我并没有改变JAVA_HOME,所以不可能。但是,在同一个wiki页面的底部,有人添加了:

A comment on the JVM search order (on Windows) - My testing (Windows 7, Eclipse 3.4.1) shows that Eclipse also looks for a JVM in the registry, in my case HKLM\Software\Wow6432Node\JavaSoft\Java Runtime Environment

关于JVM搜索顺序的评论(在Windows上) - 我的测试(Windows 7,Eclipse 3.4.1)显示Eclipse也在注册表中查找JVM,在我的例子中是HKLM \ Software \ Wow6432Node \ JavaSoft \ Java Runtime Environment

So I found the mentioned registry entry, which now had the value of "1.5" and changed it to "1.6", then restarted my PC (windows 7), and voila - Eclipse went back alive.

所以我找到了提到的注册表项,现在它的值为“1.5”,并将其更改为“1.6”,然后重新启动我的PC(Windows 7),并且瞧 - Eclipse回归活着。

I agree that adding "-vm" might fix this, although it didn't seem to work for me (maybe I didn't add it in the right place/format). But IMO, the registry fix was the better one in my case. After restarting my computer and seeing Eclipse was back to normal, I uninstalled JRE 5 (through "Add or remove programs") just to tie up loose ends.

我同意添加“-vm”可能会解决这个问题,虽然它似乎对我不起作用(也许我没有将它添加到正确的位置/格式)。但IMO,在我的情况下,注册表修复是更好的。重新启动计算机并看到Eclipse恢复正常后,我卸载了JRE 5(通过“添加或删除程序”)只是为了解决松散的问题。

#8


1  

In my case installing the most recent JRE worked well: http://www.oracle.com/technetwork/java/javase/overview/index.html

在我的情况下安装最新的JRE运行良好:http://www.oracle.com/technetwork/java/javase/overview/index.html

#9


1  

I had the same problem when I recently installed JDK 7 Update 9. My eclipse did not open and when I run "java -version" from CMD, it did not work either. I had PATH variable set to the correct bin directory.

我最近安装JDK 7 Update 9时遇到了同样的问题。我的eclipse没有打开,当我从CMD运行“java -version”时,它也没有用。我将PATH变量设置为正确的bin目录。

Anyways, eventually when I set JAVA_HOME to the new installation directory, eclipse started fine. Not sure what is the problem with JDK 7 Update 9.

无论如何,最终当我将JAVA_HOME设置到新的安装目录时,eclipse就开始了。不确定JDK 7 Update 9有什么问题。

#10


0  

Make sure everything is setup correctly under "installed JREs" under the Eclipse preferences.

确保在Eclipse首选项下的“已安装的JRE”下正确设置了所有内容。

#11


0  

The simple solution that worked for me, since other resolution required admin privilege is executing the below command from command prompt

这个简单的解决方案对我有用,因为其他解析所需的管理员权限是从命令提示符执行以下命令

eclipse -vm C:\Java\jdk1.7.0_72\bin\javaw

eclipse -vm C:\ Java \ jdk1.7.0_72 \ bin \ javaw

Also, to make the eclipse shortcut work by editing the shortcut.Append -vm C:\Java\jdk1.7.0_72\bin\javaw in the target section

此外,通过编辑快捷方式使eclipse快捷方式工作。目标部分中的-Agnd -vm C:\ Java \ jdk1.7.0_72 \ bin \ javaw