Intellij的想法:导入Gradle项目 - 获取尚未定义的JAVA_HOME [英] Intellij Idea: Importing Gradle project - getting JAVA_HOME not defined yet
问题描述
Intellij Idea 14.1.4
Mac OS X Yosemite 10.10.3及更高版本。
Intellij Idea 14.1.4 Mac OS X Yosemite 10.10.3 and later.
在IDE中:
From the IDE:
Import Project ->
(Chosen directory to import) ->
Import project from external model, Gradle ->
Gradle Home: /usr/local/Cellar/gradle/2.4/libexec
Gradle JVM: Use JAVA_HOME (not defined yet)
从shell:
From shell:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
(定义于。 profile:export JAVA_HOME =$(/ usr / libexec / java_home -v 1.8)
(defined in .profile: export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
我错过了什么,例如, Intellij JAVA_HOME变量,但没有Project SDK提示。
What am I missing. I have checked other discussions in SO, for example, Intellij JAVA_HOME variable, but don't have Project SDK prompt.
推荐答案
你需要为Java项目设置一个SDK,就像@rizzletang说的那样,但你不需要创建一个新项目,你可以从 Welcome
屏幕。
You need to setup a SDK for Java projects, like @rizzletang said, but you don't need to create a new project, you can do it from the Welcome
screen.
在右下角,选择配置>项目默认值> Pr oject Structure
:
On the bottom right, select Configure > Project Defaults > Project Structure
:
在左边选取项目
选项卡将显示您没有选择SDK:
Picking the Project
tab on the left will show that you have no SDK selected:
只需点击下拉框右侧的 New ...
按钮并将其指向您的JDK。之后,你可以回到导入屏幕,它应该显示出来。
Just click the New...
button on the right hand side of the dropdown and point it to your JDK. After that, you can go back to the import screen and it should just show up.
这篇关于Intellij的想法:导入Gradle项目 - 获取尚未定义的JAVA_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!