IntelliJ - Can't start - “JAVA_HOME does not point to a valid JVM installation”

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

For every other StackOverflow question that's been asked about this, here, here, and here, I've followed all the steps to resolve this issue, and none have worked.

When launching IntelliJ IDEA 64-bit on my 64-bit Windows 7 machine, I encounter the following error:

The environment variable JAVA_HOME (with the value of "C:\Program Files\Java\jdk1.8.0_74")  does not point to a valid JVM installation. 

However, the file path does exist:

And in my Environment Variables, I have set JAVA_HOME to that location:

I've tinkered around with putting it in my User variables instead of the System and vice-versa, and tried putting it in both. It didn't work with the Java 7 JDK I had originally, so I just downloaded the Java 8 JDK and tried it - no dice.

I also restarted my computer, and CMD can use java and javac with no problem at all:

Any help on how I could resolve this? My last resort is uninstalling and reinstalling IntelliJ, which I may have to do.

回答1:

The java and javac executables are using the PATH environment variable, while intelliJ is using JAVA_HOME variable. Remove the additional quotation marks in your JAVA_HOME value.

It might shows that your path to the jdk installation directory is hard coded in the PATH, rather then using %JAVA_HOME%.



回答2:

In my case, the issue was that JAVA_HOME was pointing to a path upto /bin folder (C:\Program Files (x86)\Java\jdk1.8.0_91\bin\) - while Eclipse accepts this, IntelliJ does not.

Updating to JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_91 resolved the issue.



回答3:

The problem will almost certainly be with the quotation marks around your JAVA_HOME path. Remove those and see if it works. If not, then I would recommend only putting your JDK installations under the root and with no spaces in them. I tend to put them in C:\JDK\1.8.0_65, etc. It makes referencing them far easier and you don't have to worry about quotation marks to protect spaces like you do with "Program Files".



回答4:

I faced the same issue.. My mistake was I was taking the path till /bin/ and putting ; at last.

Correct is - JAVA_HOME=C:\Program Files\Java\jdk1.8.0_92

no /bin/ no ';'



回答5:

Open a CMD window, and enter:

echo %JAVA_HOME% 

Verify the result is indeed the path entered your JAVA_HOME variable, i.e. C:\Program Files\Java\jdk1.8.0_74.

In my case, a space was slipped in, that was not visible in the Envrironment Variables window.



回答6:

My problem was adding 2 path in JAVA_HOME variable (I had added x64 jdk path with x86 jdk and my android studio needed just the x86 one. I deleted the x64 path and it has just worked :)



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!