JetBrain IntelliJ IDEA 如何选择 Java 启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14188179/
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
How JetBrain IntelliJ IDEA select Java to bootup
提问by Gelin Luo
I have install Java 8 EA on my Window 7, but it's neither in my %JAVA_HOME%
nor in the %PATH%
. However when I start my IntelliJ IDEA v12 by clicking idea64.exe
, it picked up java 8 EA instead of my Java SDK 1.6.0_32, which is in the %JAVA_HOME%
and %PATH%
.
我已经在我的 Window 7 上安装了 Java 8 EA,但它既不在我%JAVA_HOME%
的%PATH%
. 但是,当我通过单击启动 IntelliJ IDEA v12 时idea64.exe
,它选择了 java 8 EA 而不是我的 Java SDK 1.6.0_32,它在%JAVA_HOME%
和 中%PATH%
。
Anyone know when IDEA started, how it decide which Java version to run?
任何人都知道 IDEA 是什么时候开始的,它是如何决定运行哪个 Java 版本的?
回答by Roman Shevchenko
It was picked from the registry.
它是从注册表中挑选出来的。
When launched from .exe IDEA looks for Java in a following order:
从 .exe 启动时,IDEA 按以下顺序查找 Java:
- IDEA_JDK (or IDEA_JDK_64) environment variable
- jre/ (or jre64/) directory in IDEA home
- registry
- JDK_HOME environment variable
- JAVA_HOME environment variable
- IDEA_JDK(或 IDEA_JDK_64)环境变量
- IDEA 主页中的 jre/(或 jre64/)目录
- 登记处
- JDK_HOME 环境变量
- JAVA_HOME 环境变量
When launched from .bat the order is same but registry isn't looked, and 64-suffixed vars aren't used (what is probably a bug).
从 .bat 启动时,顺序相同但不查看注册表,并且不使用 64 后缀的变量(这可能是一个错误)。
回答by dawogfather
Here is the available options that you can use for all the different operating systems. If you are interested.
以下是可用于所有不同操作系统的可用选项。如果你感兴趣。
回答by Joshua
You can add an additional environment variable called IDEA_JDK to target the specific JDK that you want Intellij to use.
您可以添加一个名为 IDEA_JDK 的附加环境变量,以针对您希望 Intellij 使用的特定 JDK。