“找不到 Java SE 运行时环境。” 安装Java后
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19329047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Could not find Java SE Runtime Environment." after installing Java
提问by azBrian
I was trying to set up Eclipse for trying my hand at Android app dev.
I downloaded Eclipse and tried to run it... discovered I needed Java JDK. Googled and found JDK 7u40 (jdk-7u40-windows-x64.exe) and installed it. The install seemed to have gone dandy but when I tried to run Eclipse I got an error as well as if I try java version
in cmd.
我试图设置 Eclipse 以尝试使用 Android 应用程序开发。我下载了 Eclipse 并尝试运行它...发现我需要 Java JDK。谷歌搜索并找到 JDK 7u40 (jdk-7u40-windows-x64.exe) 并安装它。安装似乎很顺利,但是当我尝试运行 Eclipse 时出现错误,就像我java version
在 cmd 中尝试一样。
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
I went to regedit, HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft and Java Runtime Environment
doesn't exist in there. Seems like this is more of a symptom than the root cause of my problems.
我去了 regedit,HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft Java Runtime Environment
,那里不存在。似乎这更像是一种症状,而不是我问题的根本原因。
My PATH looks like
我的路径看起来像
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program File
s (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Window
s;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Progra
m Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Window
s Live\Shared;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\AIR\bin;C:
\Program Files (x86)\nodejs\;C:\SDK\Android\tools;C:\SDK\Android\platform-tools;
C:\SDK\ANT\apache-ant-1.9.2\bin;C:\Program Files\Java\jdk1.7.0_40\bin\
%JAVA_HOME% = C:\Program Files\Java\jdk1.7.0_40
%JAVA_HOME% = C:\Program Files\Java\jdk1.7.0_40
I'm running Windows 7 Pro 64-bit
我运行的是 Windows 7 Pro 64 位
I did already read through Error when checking Java version: could not find java.dlland linked materials
检查 Java 版本时我确实已经通读了错误:找不到 java.dll和链接的材料
采纳答案by azBrian
Finally found a forum post that outlined what the registry is supposed to look like when not broken.
终于找到了一个论坛帖子,其中概述了注册表未损坏时的外观。
- Added key
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
- Added String Value
CurrentVersion
=1.7
- Added key
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7
- Added String Value
JavaHome
=C:\Program Files\Java\jre7
- 添加了密钥
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
- 添加的字符串值
CurrentVersion
=1.7
- 添加了密钥
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7
- 添加的字符串值
JavaHome
=C:\Program Files\Java\jre7
Running cmd java -version
and Eclipse now works
运行 cmdjava -version
和 Eclipse 现在可以工作了
回答by Edwin Buck
A 32 bit eclipse cannot load a 64 bit Java Runtime Environment.
32 位 eclipse 无法加载 64 位 Java 运行时环境。
Try again with a 32 bit Java Runtime Environment, or (preferred) upgrade your Eclipse to a 64 bit version.
使用 32 位 Java 运行时环境再试一次,或者(首选)将 Eclipse 升级到 64 位版本。
Also, a good idea (from the command line)
另外,一个好主意(来自命令行)
C:> java -version
Which should give you details about your JVM. If it doesn't work, focus on fixing that before fixing Eclipse's use of Java.
这应该为您提供有关 JVM 的详细信息。如果它不起作用,请在修复 Eclipse 对 Java 的使用之前专注于修复它。
回答by Peachytaemints
You can try reinstall your JDK. I've had this problem because I uninstalled so many java things in my PC. And when I open Eclipse, the error occurred.
您可以尝试重新安装JDK。我遇到了这个问题,因为我在我的电脑上卸载了很多 Java 东西。当我打开 Eclipse 时,发生了错误。
回答by Steven
I was getting the same error (below) for Oracle when I clicked on a G2 application.
当我单击 G2 应用程序时,我遇到了与 Oracle 相同的错误(如下所示)。
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
错误:打开注册表项“Software\JavaSoft\Java 运行时环境”
错误:找不到 java.dll
错误:找不到 Java SE 运行时环境。
I restarted the machine, still the same.
我重启了机器,还是一样。
I reinstalled the app (which includes Oracle), still the same.
我重新安装了应用程序(包括 Oracle),还是一样。
I checked all the suggested registry settings as suggested and my registry was fine.
我按照建议检查了所有建议的注册表设置,我的注册表很好。
I checked the shortcut path and it fires up javaw.exe with a string following within the shortcut. I navigated to the G2 program files and I tried clicking in the javaw.exe directly within the application folder and got the same error.
我检查了快捷方式路径,它启动了 javaw.exe 并在快捷方式中跟随一个字符串。我导航到 G2 程序文件,并尝试直接在应用程序文件夹中单击 javaw.exe 并得到相同的错误。
I did some research into this and found that Java has a Javaw.exe within the following path:
我对此进行了一些研究,发现 Java 在以下路径中有一个 Javaw.exe:
C:\Program Files\Java\jre7\bin\javaw.exe
C:\Program Files\Java\jre7\bin\javaw.exe
I navigated to the path and clicked on this javaw.exe file and didn't get any errors
我导航到路径并单击此 javaw.exe 文件,但没有出现任何错误
I renamed the javaw.exe in the G2 app to javaw_old.exe and then copied and pasted the javaw.exe file from the above path into my app folder. Files side by side, you could see a file size difference and the date was 8 months difference. The newer and larger file being the one in the latest Java install folder.
我将 G2 应用程序中的 javaw.exe 重命名为 javaw_old.exe,然后将上述路径中的 javaw.exe 文件复制并粘贴到我的应用程序文件夹中。文件并排,您可以看到文件大小差异,日期相差 8 个月。最新的更大的文件是最新的 Java 安装文件夹中的文件。
Clicked on the G2 shortcut and the application opened without any errors.
单击 G2 快捷方式,应用程序打开时没有任何错误。
If you have the same issue as me where everything Java is okay and your still getting the error, try find the java(.exe) file that your app is erroring on, rename it and copy and paste the same file from your Java folder (C:\Program Files\Java\jre7\bin) to the same folder your app's Java file is located.
如果您和我有同样的问题,Java 一切正常,但仍然出现错误,请尝试找到您的应用出错的 java(.exe) 文件,重命名它,然后从 Java 文件夹中复制并粘贴相同的文件( C:\Program Files\Java\jre7\bin) 到您的应用程序的 Java 文件所在的同一文件夹。
I hope this helps someone.
我希望这可以帮助别人。
回答by Dev M
You can tell eclipse which JRE to use in the eclipse.ini. If you've installed bundles that require 1.7 in your IDE you will need a 1.7 JRE to run the IDE itself. add the below lines to eclipse.ini file
您可以在 eclipse.ini 中告诉 eclipse 使用哪个 JRE。如果您在 IDE 中安装了需要 1.7 版本的包,您将需要一个 1.7 JRE 来运行 IDE 本身。将以下行添加到 eclipse.ini 文件
-startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
.
.
.
-startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
。
.
.
回答by kolobok
Just reinstall your JRE. You will probably need to restart a computer after uninstalling.
只需重新安装您的 JRE。卸载后您可能需要重新启动计算机。
回答by Abhishek Singh
As most of us suggested to edit the registry, but in case you don't want to, because it's risky or you don't have permissions to do so, you can uninstall all the java version, restart your machine, install desired java version, make sure to set path settings. This worked for me.
正如我们大多数人建议编辑注册表,但如果您不想这样做,因为它有风险或您没有权限这样做,您可以卸载所有java版本,重新启动机器,安装所需的java版本,确保设置路径设置。这对我有用。
回答by Lucky
Having both 1.7 and 1.8 caused me this problem. While uninstalling 1.8 some of the 1.7 registry keys were removed I guess. I was missing the key Java Runtime Environment and JavaHome String. Uninstalling all the versions of JDK and reinstalling the 1.7(update 80) solved me the problem.
同时拥有 1.7 和 1.8 给我带来了这个问题。在卸载 1.8 时,我猜一些 1.7 注册表项被删除了。我错过了关键的 Java 运行时环境和 JavaHome 字符串。卸载所有版本的 JDK 并重新安装 1.7(更新 80)解决了我的问题。
回答by communityUser
I had exactly the same problem and exactly same set of errors. That was because my registry key Java Runtime Environment was missing altogether. I did not have any conflicting 32/64 bit settings or any conflicting 1.7/1.8 settings.
我遇到了完全相同的问题和完全相同的错误集。那是因为我的注册表项 Java Runtime Environment 完全丢失了。我没有任何冲突的 32/64 位设置或任何冲突的 1.7/1.8 设置。
All I did was install an update provided by Java and my settings went haywire. What I did to resolve was, instead of updating registry entries myself, I simply did an uninstall and fresh install of JRE and everything was back to normal.
我所做的只是安装了 Java 提供的更新,然后我的设置就出问题了。我要解决的是,我没有自己更新注册表项,而是简单地卸载并全新安装了 JRE,一切都恢复了正常。