简体   繁体   English

Java 错误打开注册表项“软件\JavaSoft\Java 运行时环境”

[英]Java Error opening registry key 'Software\JavaSoft\Java Runtime Environment'

When running "java -version" on command prompt Windows 7, i get this:在命令提示符 Windows 7 上运行“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 have already checked environment variables:我已经检查了环境变量:

JAVA_HOME = C:\Program Files\Java\jdk1.8.0_212\bin

And PATH includes "%JAVA_HOME%并且PATH包括"%JAVA_HOME%

I have also tried deleting files : java.exe, javaw.exe and javaws.exe in ProgramData\Oracle\JAVA\Javapath However, they won't delete.我也尝试过在ProgramData\Oracle\JAVA\Javapath中删除文件:java.exe、javaw.exe 和 javaws.exe 但是,它们不会删除。 Even though I am an administrator.虽然我是管理员。

I have also checked C:\Windows\System32 and C:\Windows\SYSWOW64 and didnt find java.exe, javaw.exe or javaws.exe to delete.我还检查了C:\Windows\System32C:\Windows\SYSWOW64并没有找到要删除的 java.exe、javaw.exe 或 javaws.exe。

What else can I try?我还能尝试什么?

  1. Do you have multiple Java installed?您是否安装了多个 Java?
  2. What is there in registry key?注册表项中有什么? Does the version specified in the registry key match with your JDK/JRE folder name?注册表项中指定的版本是否与您的 JDK/JRE 文件夹名称匹配? Use regedit command to open the registry and look for the key you mentioned in your question ( HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion ).使用regedit命令打开注册表并查找您在问题中提到的密钥( HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion )。 Cleanup/correct the version if you see a discrepancy.如果发现差异,请清理/更正版本。
  3. JAVA_HOME should be the path excluding bin and PATH should include bin as %JAVA_HOME%\bin JAVA_HOME应该是不包括bin的路径, PATH应该包括 bin 作为%JAVA_HOME%\bin
  4. Are there duplicate entries in PATH and also duplication between user and system environment variables? PATH中是否存在重复条目以及用户和系统环境变量之间是否存在重复?
  5. Can you directly go (cd) to JDK/JRE bin directory where java executable is present and run java -version ?您可以直接转到(cd)到存在 java 可执行文件的 JDK/JRE bin 目录并运行java -version吗?
  6. Lastly, I hope you looked at C:\Windows\System32 and C:\Windows\SYSWOW64 directories and removed java.exe and related files.最后,希望您查看C:\Windows\System32C:\Windows\SYSWOW64目录并删除 java.exe 和相关文件。

This error also comes when the software you are using is of 32-bit and you have a 64-bit version of Java installed which is not compatible with the existing softwares where you want to work.当您使用的软件是 32 位并且您安装了与您想要工作的现有软件不兼容的 64 位版本的 Java 时,也会出现此错误。 You may also uninstall 64-bit and install the 32-bit version which will resolve the issue.您也可以卸载 64 位并安装将解决问题的 32 位版本。

This happened to me when I uninstalled and old Oracle version of Java.当我卸载旧的 Oracle 版本的 Java 时,这发生在我身上。 The registry key was deleted but a Java executable remained in a hidden folder.注册表项已删除,但 Java 可执行文件仍保留在隐藏文件夹中。 For proper cleanup进行适当的清理

(on Windows): (在 Windows 上):

where java will reveal the location of the shortcut, eg, C:\ProgramData\Oracle\Java\javapath\java.exe (notice that this is a hidden folder). where java将显示快捷方式的位置,例如C:\ProgramData\Oracle\Java\javapath\java.exe (注意这是一个隐藏文件夹)。

Assuming you wanted to get rid of the old Java version, you can delete this folder, and the corresponding path entry.假设你想摆脱旧的 Java 版本,你可以删除这个文件夹,以及相应的路径条目。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM