IntelliJ - 无法启动 - “JAVA_HOME 未指向有效的 JVM 安装”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36159433/
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
IntelliJ - Can't start - "JAVA_HOME does not point to a valid JVM installation"
提问by homersimpson
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.
对于每个其他 StackOverflow 问题,这里、这里和这里,我已经按照所有步骤解决了这个问题,但没有一个成功。
When launching IntelliJ IDEA 64-bit on my 64-bit Windows 7 machine, I encounter the following error:
在我的 64 位 Windows 7 机器上启动 IntelliJ IDEA 64 位时,我遇到以下错误:
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:
在我的环境变量中,我已设置JAVA_HOME
为该位置:
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.
我已经修改了将它放在我的用户变量中而不是系统中,反之亦然,并尝试将它放在两者中。它不适用于我最初使用的 Java 7 JDK,所以我只是下载了 Java 8 JDK 并尝试了它 - 没有骰子。
I also restarted my computer, and CMD can use java
and javac
with no problem at all:
我也重新启动了我的计算机,CMD 可以使用java
并且javac
完全没有问题:
Any help on how I could resolve this? My last resort is uninstalling and reinstalling IntelliJ, which I may have to do.
关于我如何解决这个问题的任何帮助?我的最后一招是卸载并重新安装 IntelliJ,这可能是我必须做的。
采纳答案by Shmulik Klein
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.
在java
和javac
可执行文件使用PATH
环境变量,而在的IntelliJ使用JAVA_HOME
变量。删除值中的附加引号JAVA_HOME
。
It might shows that your path to the jdk installation directory is hard coded in the PATH
, rather then using %JAVA_HOME%
.
这可能表明,你的JDK安装目录的路径是硬编码的PATH
,而不是使用%JAVA_HOME%
。
回答by ManoDestra
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".
问题几乎肯定出在 JAVA_HOME 路径周围的引号中。删除它们,看看它是否有效。如果没有,那么我建议只将您的 JDK 安装放在根目录下,并且其中没有空格。我倾向于将它们放在C:\JDK\1.8.0_65
等中。它使引用它们变得容易得多,而且您不必像使用“程序文件”那样担心引号来保护空格。
回答by Robert F Little
Open a CMD window, and enter:
打开一个 CMD 窗口,然后输入:
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
.
验证结果确实是输入JAVA_HOME
变量的路径,即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.
就我而言,插入了一个空间,这在环境变量窗口中是不可见的。
回答by Sachin Lala
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.
就我而言,问题是JAVA_HOME
指向 /bin 文件夹 ( C:\Program Files (x86)\Java\jdk1.8.0_91\bin\
)的路径- 虽然 Eclipse 接受这一点,但 IntelliJ 不接受。
Updating to JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_91
resolved the issue.
更新以JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_91
解决问题。
回答by Pardeep Sharma
I faced the same issue.. My mistake was I was taking the path till /bin/ and putting ; at last.
我遇到了同样的问题.. 我的错误是我走的路直到 /bin/ 并把 ; 最后。
Correct is - JAVA_HOME=C:\Program Files\Java\jdk1.8.0_92
正确的是 - JAVA_HOME=C:\Program Files\Java\jdk1.8.0_92
no /bin/ no ';'
没有 /bin/ 没有 ';'
回答by Mahdieh Shavandi
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 :)
我的问题是在 JAVA_HOME 变量中添加了 2 个路径(我添加了 x64 jdk 路径和 x86 jdk,而我的 android studio 只需要 x86 路径。我删除了 x64 路径,它刚刚工作:)
回答by I.Trisha
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
从命令行打开 PHPSTORM 时遇到了同样的问题。解决方案是下载 jdk version 8 x86(32bit)。通过将用户变量中的 JAVA_HOME 路径设置为 C:\Program Files (x86)\Java\jdk1.8.0_221 来编辑环境变量中的设置
回答by Den
You can also change the installation of OpenJDK (if you still have the installer packages) and add the JAVA_HOME variable (you have to enable it), afterwards just click through the installation until it is finished.
您还可以更改 OpenJDK 的安装(如果您还有安装程序包)并添加 JAVA_HOME 变量(您必须启用它),然后单击安装直到完成。