简体   繁体   中英

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

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.

启动 IDEA 时出错

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.

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.

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% .

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".

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 ';'

Had the same issues opening PHPSTORM from command line. Solution was to download jdk version 8 x86(32bit). Edit settings in Environment Variables by setting JAVA_HOME path in user variables for... to C:\\Program Files (x86)\\Java\\jdk1.8.0_221

Open a CMD window, and enter:

echo %JAVA_HOME%

Verify the result is indeed the path entered your JAVA_HOME variable, ie 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.

我的问题是在 JAVA_HOME 变量中添加了 2 个路径(我添加了 x64 jdk 路径和 x86 jdk,而我的 android studio 只需要 x86 路径。我删除了 x64 路径,它刚刚工作:)

我遇到的问题似乎是由于尝试启动 idea.exe 而不是 idea64.exe - 当我移动到 64 时,它就起作用了。

Since this question appeared in my google search, and none of the aforementioned answers worked for me - here is my resolution.

What worked for me was changing \\ to / in path.

So in my case it was: C:/Program Files/Java/jdk-11.0.11/ :)

您还可以更改 OpenJDK 的安装(如果您还有安装程序包)并添加 JAVA_HOME 变量(您必须启用它),然后单击安装直到完成。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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