简体   繁体   English

安装Java后,“找不到Java SE Runtime Environment。”

[英]“Could not find Java SE Runtime Environment.” after installing Java

I was trying to set up Eclipse for trying my hand at Android app dev. 我试图设置Eclipse以尝试使用Android应用程序开发人员。 I downloaded Eclipse and tried to run it... discovered I needed Java JDK. 我下载了Eclipse并尝试运行它。发现我需要Java JDK。 Googled and found JDK 7u40 (jdk-7u40-windows-x64.exe) and installed it. 搜索并找到JDK 7u40(jdk-7u40-windows-x64.exe)并安装它。 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时,出现错误以及尝试在cmd中使用java version

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. 我去了regedit,那里不存在HKEY_LOCAL_MACHINE / SOFTWARE / JavaSoft和Java Runtime Environment Seems like this is more of a symptom than the root cause of my problems. 似乎这更多是一种症状,而不是我的问题的根本原因。

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.dll and linked materials 在检查Java版本时确实已经阅读了错误:找不到java.dll和链接的资料

Finally found a forum post that outlined what the registry is supposed to look like when not broken. 最终找到了一个论坛帖子,概述了注册表未损坏时的外观。

  1. Added key HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment 添加了键HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment
  2. Added String Value CurrentVersion = 1.7 添加的字符串值CurrentVersion = 1.7
  3. Added key HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.7 添加了密钥HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\1.7
  4. Added String Value JavaHome = C:\\Program Files\\Java\\jre7 添加了字符串值JavaHome = C:\\Program Files\\Java\\jre7

Running cmd java -version and Eclipse now works 现在可以运行cmd java -version和Eclipse

You can tell eclipse which JRE to use in the eclipse.ini. 您可以在eclipse.ini中告诉eclipse使用哪个JRE。 If you've installed bundles that require 1.7 in your IDE you will need a 1.7 JRE to run the IDE itself. 如果在IDE中安装了需要1.7的捆绑软件,则需要1.7 JRE来运行IDE本身。 add the below lines to eclipse.ini file 将以下行添加到eclipse.ini文件

-startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -startup plugins / org.eclipse.equinox.launcher_1.2.0.v20110502.jar
-vm C:\\Program Files (x86)\\Java\\jre7\\bin\\javaw.exe -vm C:\\ Program Files(x86)\\ Java \\ jre7 \\ bin \\ javaw.exe
.
.
.

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. 哪个应该为您提供有关JVM的详细信息。 If it doesn't work, focus on fixing that before fixing Eclipse's use of Java. 如果不起作用,请先解决此问题,再修复Eclipse对Java的使用。

You can try reinstall your JDK. 您可以尝试重新安装JDK。 I've had this problem because I uninstalled so many java things in my PC. 我遇到了这个问题,因为我在PC上卸载了很多Java东西。 And when I open Eclipse, the error occurred. 当我打开Eclipse时,发生了错误。

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. 正如我们大多数人建议编辑注册表一样,但是如果您不想这样做,因为这样做有风险或没有权限,可以卸载所有Java版本,重新启动计算机,安装所需的Java版本。 ,请确保设置路径设置。 This worked for me. 这对我有用。

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' 错误:打开注册表项“ Software \\ JavaSoft \\ Java Runtime Environment”

Error: could not find java.dll 错误:找不到java.dll

Error: Could not find Java SE Runtime Environment. 错误:找不到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. 我检查了快捷方式路径,并使用快捷方式中后面的字符串启动了javaw.exe。 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. 我导航到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. 我将G2应用程序中的javaw.exe重命名为javaw_old.exe,然后将上述路径中的javaw.exe文件复制并粘贴到我的应用程序文件夹中。 Files side by side, you could see a file size difference and the date was 8 months difference. 并排显示文件,您会看到文件大小差异,并且日期相差8个月。 The newer and larger file being the one in the latest Java install folder. 较新的较大文件是最新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. 我希望这可以帮助别人。

Just reinstall your JRE. 只需重新安装您的JRE。 You will probably need to restart a computer after uninstalling. 卸载后,您可能需要重新启动计算机。

Having both 1.7 and 1.8 caused me this problem. 同时拥有1.7和1.8会导致我遇到这个问题。 While uninstalling 1.8 some of the 1.7 registry keys were removed I guess. 我想在卸载1.8时会删除一些1.7注册表项。 I was missing the key Java Runtime Environment and JavaHome String. 我缺少关键的Java Runtime Environment和JavaHome String。 Uninstalling all the versions of JDK and reinstalling the 1.7(update 80) solved me the problem. 卸载所有版本的JDK并重新安装1.7(更新80)解决了我的问题。

I had exactly the same problem and exactly same set of errors. 我遇到了完全相同的问题,并且完全相同的一组错误。 That was because my registry key Java Runtime Environment was missing altogether. 那是因为我的注册表项Java Runtime Environment完全丢失了。 I did not have any conflicting 32/64 bit settings or any conflicting 1.7/1.8 settings. 我没有任何冲突的32/64位设置或任何冲突的1.7 / 1.8设置。

All I did was install an update provided by Java and my settings went haywire. 我所做的只是安装了Java提供的更新,而我的设置陷入了麻烦。 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. 我要做的是解决问题,而不是自己更新注册表项,我只是简单地卸载了JRE,然后重新安装了JRE,一切恢复了正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse:“找不到 Java SE 运行时环境” - Eclipse: "Could not find Java SE Runtime Environment" 错误找不到Java SE Runtime Environment /从头开始 - Error could not find Java SE Runtime Environment / Start from scratch Ren'py 启动器:“找不到 Java SE 运行时环境” - Ren'py launcher: “Cannot find Java SE Runtime environment” Eclipse:找不到Java 2 Runtime Environment - Eclipse: Could not find Java 2 Runtime Environment java.lang.IllegalStateException:找不到有效的 Docker 环境。 请查看日志并检查配置 - java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration 为什么我仍然无法找到 Java SE 运行时环境? - Why am I still getting a cannot find Java SE Runtime Environment? 为什么我无法再次找到Java SE Runtime Environment? - Why am I getting cannot find Java SE Runtime Environment again? 从命令行下载 Windows 上最新的 Java SE Runtime Environment 8 - From command line download latest Java SE Runtime Environment 8 on Windows Java 运行时环境检测到致命错误。 EXCEPTION_ACCESS_VIOLATION - A fatal error has been detected by the Java Runtime Environment. EXCEPTION_ACCESS_VIOLATION 错误:找不到libjava.so,错误:找不到Java 2运行时环境 - Error: could not find libjava.so, Error: could not find Java 2 Runtime Environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM