Intellij Idea 14.1.4 Mac OS X Yosemite 10.10.3 and later.
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)
From shell:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
(defined in .profile: export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
What am I missing. I have checked other discussions in SO, for example, Intellij JAVA_HOME variable, but don't have Project SDK prompt.
This question is related to
java
macos
intellij-idea
gradle
Just to add completness to the above selected answer, one can also go the 'Project Setting' windows (if not on the Welcome screen) in IntelliJ IDEA by clicking:
File > Project Structure (Ctrl + Alt + Shift + S)
And can define Project SDK there!
For Windows Platform:
try Running the 64 Bit exe version of IntelliJ from a path similar to following.
note that it is available beside the default idea.exe
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0\bin\idea64.exe"
For MacOS this worked for me without the need to hardcode a particular Java version:
launchctl setenv JAVA_HOME "$(jenv javahome)"
Try starting IntelliJ from terminal. You can find application file under: /Applications/IntelliJ\ IDEA\ 14.app/Contents/MacOS
If you'd like to have your JAVA_HOME recognised by intellij, you can do one of these:
launchctl setenv JAVA_HOME "/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home"
As others have answered you can ignore JAVA_HOME by setting up SDK in project structure.
Make sure you have a jdk setup. To do this, create a new project and then go to file -> project structure. From there you can add a new jdk. Once that is setup, go back to your gradle project and you should have a jdk to select in the 'Gradle JVM' field.
Source: Stackoverflow.com