简体   繁体   English

为什么我仍然无法找到 Java SE 运行时环境?

[英]Why am I still getting a cannot find Java SE Runtime Environment?

These are the errors I get when I try to run a simple java version in the command window.这些是我尝试在命令窗口中运行简单的 Java 版本时遇到的错误。在此处输入图片说明

I followed the advice on Error: Registry key 'Software\\JavaSoft\\Java Runtime Environment'\\CurrentVersion'?我遵循了关于错误的建议:注册表项 'Software\\JavaSoft\\Java Runtime Environment'\\CurrentVersion'? . . When I went on regedit, here's what I saw当我使用 regedit 时,这是我看到的

Which meant that there was nothing to change - right runtime version.这意味着没有什么可以改变 - 正确的运行时版本。 I then did the next step which was to "delete all previous versions of Java (using "Programs and Features" uninstall process) and then re-install just the version you want to work with" However, that didn't work either...... Here is my current java directory(see that i have everything installed)然后我做了下一步,即“删除所有以前版本的 Java(使用“程序和功能”卸载过程),然后仅重新安装您想要使用的版本”但是,这也不起作用.. .... 这是我当前的 java 目录(看到我已经安装了所有东西)在此处输入图片说明

And my current environmental variables are我目前的环境变量是

JAVA_HOME - C:\Program Files\Java\jdk1.7.0_71

Path - C:\Program Files\Java\jdk1.7.0_71\bin

which i believe are correct as well from http://www.oracle.com/technetwork/java/javase/install-windows-189425.html我认为来自http://www.oracle.com/technetwork/java/javase/install-windows-189425.html 的也是正确的

Does anyone know how i can get rid of this issue?有谁知道我如何摆脱这个问题? I could do one more uninstall/install but I think that be a waste of time and won't make a difference.我可以再卸载/安装一次,但我认为这是浪费时间,不会有什么不同。

I want to thank @almas-shaikh for this answer.我要感谢@almas-shaikh 的回答。 His comment made me check over C:\\Program Files\\Java\\jdk1.7.0_71\\jre\\bin and see that there was no java.dll library file inside that directory.他的评论让我检查 C:\\Program Files\\Java\\jdk1.7.0_71\\jre\\bin 并看到该目录中没有 java.dll 库文件。 What I did next was just deleting the jdk and reinstalling it via jdk-7u71-windows-x64.exe executable.我接下来所做的只是删除 jdk 并通过 jdk-7u71-windows-x64.exe 可执行文件重新安装它。 Now when I execute java -home, I get现在当我执行 java -home 时,我得到在此处输入图片说明

Now the part I don't get is how the java.dll library file was deleted in the first place......现在我没搞懂的部分是java.dll库文件是如何被删除的……

Please try the steps.请尝试以下步骤。 I hope, it will help you.我希望,它会帮助你。

Step 1: Delete all previous versions of Java (using "Programs and Features" uninstall process).步骤 1:删除所有以前版本的 Java(使用“程序和功能”卸载过程)。 If java folder is remain in "C:/Program Files/...", please delete it.如果java文件夹仍然在“C:/Program Files/...”中,请删除它。

Step 2: Clean up your registry(delete your java key).第 2 步:清理您的注册表(删除您的 Java 密钥)。 Please follow the below link for step by step clean up请按照以下链接逐步清理
https://java.com/en/download/help/manual_regedit.xml https://java.com/en/download/help/manual_regedit.xml

Step 3: Reinstall Java and sets system variable JAVA_HOME to your JDK path.第 3 步:重新安装 Java 并将系统变量 JAVA_HOME 设置为您的 JDK 路径。
Eg:例如:
JAVA_HOME - C:\\Program Files\\Java\\jdk1.7.0_71 JAVA_HOME - C:\\Program Files\\Java\\jdk1.7.0_71
Path - C:\\Program Files\\Java\\jdk1.7.0_71\\bin路径 - C:\\Program Files\\Java\\jdk1.7.0_71\\bin

Step 4 If step 3 is success, check with below command步骤 4如果步骤 3 成功,请检查以下命令
1) echo %JAVA_HOME% 1) 回显 %JAVA_HOME%
2) java -version 2) java -version

I had similar problem.我有类似的问题。 Turns out, even when you have 64-bit OS, your browser is most likely 32-bit and therefore your JAVA too.事实证明,即使您拥有 64 位操作系统,您的浏览器也很可能是 32 位的,因此您的 JAVA 也是如此。 You need to manually install 64-bit JAVA.您需要手动安装 64 位 JAVA。

I hope that will help.我希望这会有所帮助。

try adding "%JAVA_HOME%\\bin;"尝试添加“%JAVA_HOME%\\bin;” in the Path section instead of this "C:\\Program Files\\Java\\jdk1.7.0_71\\bin", should make no difference but just try it like this.在 Path 部分而不是这个“C:\\Program Files\\Java\\jdk1.7.0_71\\bin”,应该没有区别,只是像这样尝试。

java installation will create a folder similar to this C:\\ProgramData\\Oracle\\Java. java 安装将创建一个类似于 C:\\ProgramData\\Oracle\\Java 的文件夹。 rename and again try cmd java -version.重命名并再次尝试 cmd java -version。

make sure you have path variable set to latest jre/bin folder确保您将路径变量设置为最新的 jre/bin 文件夹

I haven't seen this answer, but this is how I ran into the problem and then solved it.我还没有看到这个答案,但这就是我遇到问题然后解决它的方式。

I had Java 14.0.2 installed and I needed IntelliJ and Maven installed.我安装了Java 14.0.2 ,我需要安装IntelliJMaven This computer is an enterprise computer so I didn't have much saying on the installation process.这台电脑是企业电脑,安装过程我就不多说了。 I suppose IntelliJ came with Java 10.0.1 or that IT installed it as part of their process and it of course threw all my system out of the window.我想IntelliJ附带了Java 10.0.1或者 IT 将它安装为他们过程的一部分,当然它把我所有的系统都扔出了窗外。

So to fix this, I had to get someone from IT to unlock the admin things for me, and then:所以为了解决这个问题,我必须让 IT 人员为我解锁管理内容,然后:

  • I deleted the JRE paths with 10.0.1我用10.0.1删除了 JRE 路径
  • Under the Windows tool to uninstall software, I deleted Java 10.0.1 JRE and JDK.在 Windows 卸载软件工具下,我删除了Java 10.0.1 JRE 和 JDK。
  • Under the Java directory, also moved or deleted those folders在Java目录下,也移动或删除了那些文件夹
  • And then I tested IntelliJ and the Terminal with java -version and javac -version to check if I was getting the same results (got 14.0.2 , nice, that is what I was expecting)然后我用java -versionjavac -version测试了IntelliJ和终端,以检查我是否得到了相同的结果(得到14.0.2 ,很好,这就是我所期待的)
  • And then checked Maven with mvn -version for the apache feedback as well, which will also return which JDK it's running.然后使用mvn -version检查Maven以获得apache反馈,这也将返回它正在运行的 JDK。

No need to fiddle with registry, or even restart the computer (just to restart the Terminal after Path changes).无需摆弄注册表,甚至无需重新启动计算机(只需在路径更改后重新启动终端)。

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

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