Java 错误打开注册表项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6362037/
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
Java Error opening registry key
提问by gFu
I get this error when I try to do anything with Java in command prompt:
当我尝试在命令提示符下使用 Java 执行任何操作时出现此错误:
Error opening registry key 'Software\JavaSoft\Java Runtime Environment.3'
Error: could not find Java.dll
Error: could not find Java 2 Runtime Environment
I did screw around with deleting Java directories and registry a few days ago. I restarted computer and java was still working fine, then i restarted it again today and now I get this error. I have tried uninstalling and reinstalling but that doesn't seem to work. I have the latest java JRE installed and the path set in the environment variables. Anyone have any clue how to fix this?
几天前我确实删除了 Java 目录和注册表。我重新启动计算机,Java 仍然正常工作,然后我今天再次重新启动它,现在出现此错误。我试过卸载并重新安装,但这似乎不起作用。我安装了最新的 java JRE 并在环境变量中设置了路径。任何人都知道如何解决这个问题?
采纳答案by Baha
Make sure you remove any java.exe
, javaw.exe
and javaws.exe
from your Windows\System32
folder and if you have an x64 system (Win 7 64 bits) also do the same under Windows\SysWOW64
.
确保从文件夹中删除任何java.exe
,javaw.exe
和如果您有 x64 系统(Win 7 64 位),也请在.javaws.exe
Windows\System32
Windows\SysWOW64
If you can't find them at these locations, try deleting them from C:\ProgramData\Oracle\Java\javapath
.
如果在这些位置找不到它们,请尝试从 中删除它们C:\ProgramData\Oracle\Java\javapath
。
回答by Tilman Hausherr
I had a similar problem. I had installed JDK7 update 1 but couldn't use it (probably because I found a JRE6 that I deleted after installing JDK7). Uninstalling JDK7 was impossible. The solution was to add the JRE registry entries by hand.
我有一个类似的问题。我已经安装了 JDK7 update 1 但无法使用它(可能是因为我发现了一个在安装 JDK7 后删除的 JRE6)。卸载 JDK7 是不可能的。解决方案是手动添加 JRE 注册表项。
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.7"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment.7]
"JavaHome"="C:\Program Files\Java\jre7"
"RuntimeLib"="C:\Program Files\Java\jre7\bin\client\jvm.dll"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment.7.0_01]
"JavaHome"="C:\Program Files\Java\jre7"
"RuntimeLib"="C:\Program Files\Java\jre7\bin\client\jvm.dll"
You'll have to adjust the above to your own directories and version.
您必须将上述内容调整为您自己的目录和版本。
If this doesn't help, there's still JavaRa http://raproducts.org/wordpress/.
如果这没有帮助,还有 JavaRa http://raproducts.org/wordpress/。
回答by Dizzixx
I would have tagged this as a comment but cant (dont have the rep) just wanted to thank Tilman. I was trying to get PDFsam (PDF Split and Merge) to work to no avail.
我会将此标记为评论,但不能(没有代表)只是想感谢 Tilman。我试图让 PDFsam(PDF 拆分和合并)工作无济于事。
At launch it would produce an error stating that it could not find JRE 1.6.0. I Have both 32 and 64 bit versions and they check out fine at the java website in their respective browsers.
在启动时,它会产生一个错误,指出它找不到 JRE 1.6.0。我有 32 位和 64 位版本,他们可以在各自浏览器的 java 网站上很好地查看。
Tried uninstalling/reinstalling and rebooting repeatedly as well as using JavaRa. No such luck, still no go.
尝试卸载/重新安装并反复重新启动以及使用 JavaRa。没有这样的运气,还是不行。
I looked in the registry after reading this post and there was no ...\SOFTWARE\JavaSoft\ key so I added each with their respective string values pointing to my x86 version (PDFsam is a 32bit program). This got past the first problem but an error popped up about amd64 libraries suggesting the machine wanted to run the 64bit version. So I changed the paths to the 64bit JRE and PDFsam now works.
阅读完这篇文章后,我查看了注册表,但没有 ...\SOFTWARE\JavaSoft\ 键,所以我添加了每个键,它们各自的字符串值指向我的 x86 版本(PDFsam 是一个 32 位程序)。这解决了第一个问题,但出现了一个关于 amd64 库的错误,表明机器想要运行 64 位版本。所以我改变了 64 位 JRE 的路径,PDFsam 现在可以工作了。
FYI - I got here by searching for Java registry keys after I was unable to launch javaw.exe from command prompt (even after adding the requisite paths to system path), making the aforementioned changes solved this as well.
仅供参考 - 在我无法从命令提示符启动 javaw.exe 之后(即使在将必要的路径添加到系统路径之后),我通过搜索 Java 注册表项来到这里,使上述更改也解决了这个问题。
回答by user3740684
Make sure you remove any java.exe, javaw.exe and javaws.exe from your system.
确保从系统中删除所有 java.exe、javaw.exe 和 javaws.exe。
if you have an x32 system (Win XP 32 bits) Windows\System32 folder
if you have an x64 system (Win 7 64 bits) also do the same under Windows\SysWOW64 folder
如果您有 x32 系统(Win XP 32 位)Windows\System32 文件夹
如果您有 x64 系统(Win 7 64 位),请在 Windows\SysWOW64 文件夹下执行相同操作
回答by zut
回答by dap1995
Uninstall Java (via Control Panel / Programs and Features)
卸载 Java(通过控制面板/程序和功能)
Install Java JRE 7 --> OFFLINE <--
Configure JAVA_HOME and Path = %JAVA_HOME%/bin;%PATH%
安装 Java JRE 7 --> OFFLINE <-- 配置 JAVA_HOME 和 Path = %JAVA_HOME%/bin;%PATH%
回答by user213013
I got this kind of error whe nI had JDK 1.7 before and I installed JAVA JDK 1.8 and pointed my JAVA_HOME and PATH variables to JAVA 1.8 version. When I try to find the java version I got this error. I restarted my machine, and it works . It seems to be we have to restart the machine after modifying the environment variables.
当我之前有 JDK 1.7 并且我安装了 JAVA JDK 1.8 并将我的 JAVA_HOME 和 PATH 变量指向 JAVA 1.8 版本时,我遇到了这种错误。当我尝试查找 Java 版本时,出现此错误。我重新启动了我的机器,它可以工作。看来是我们修改了环境变量后必须重启机器。
回答by Shuvankar Paul
You will find a folder named "Oracle" on ProgramData folder in your windows installed drive. Remove the folder. Hope it will work. In my case my install drive is C and my path is C:\ProgramData\Oracle
您将在 Windows 安装驱动器的 ProgramData 文件夹中找到一个名为“ Oracle”的文件夹。删除文件夹。希望它会起作用。在我的情况下,我的安装驱动器是 C,我的路径是C:\ProgramData\Oracle
回答by Marcin Piaskowski
There are 3 locations to check
有3个位置要检查
- Registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_xxx\JavaHome
- Java Control Panel- Java tab - View - Path
- Environment Variables - Path ($env:Path)
- 注册表 HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_xxx\JavaHome
- Java 控制面板 - Java 选项卡 - 视图 - 路径
- 环境变量 - 路径 ($env:Path)
All 3 have to align (if you have multiple entires just remove the wrong ones) - thats all
所有 3 个都必须对齐(如果您有多个整体,只需删除错误的)-仅此而已