Point your JAVA_HOME to JDK, not to JRE.
if you are using Intellij version 10.x you should not install any Plugin to run a gradle script.
All you have to do is to go to the Gradle setup (File -> Settings -> Gradle
) and set the Gradle Home folder (the location of your Gradle installation, eg. C:\tools\gradle).
You should be able to select a Gradle build file and run it.
IntelliJ uses its own jre.
to force IntelliJ to use it, you need to set the environment variable IDEA_JDK
to point to your JDK.
then simply restart intellij and gradle gui plugin should now work.
Man I had so much trouble with this as well, and I don't remember having this much trouble before. I think they changed something. Here are the incantations which got it working for me on Mac OS X 10.11.5, both with Java and Gradle on IntelliJ 2016.1
Here's the summary: install the latest Java JDK from Oracle, add the java_home value to $JAVA_HOME and set that value to $IDEA_HOME (IntelliJ's variable for defining which JDK to use), install gradle (optional) using homebrew, then define the project SDK in IntelliJ.
Here it is broken down from the very beginning of a clean install:
IntelliJ ships with its own version of Gradle, so this is really optional, and is helpful if you want to use Gradle outside of IntelliJ.
`brew update && brew install gradle`
Paste the following into ~/.profile
. These values will work regardless of which version of java or gradle you have installed. Don't set the GRADLE_HOME if you didn't install the standalone gradle.
export JAVA_HOME=$(/usr/libexec/java_home)
export IDEA_JDK=$JAVA_HOME
export GRADLE_HOME=/usr/local/opt/gradle/libexec
launchctl
program:launchctl setenv JAVA_HOME $(/usr/libexec/java_home)
Use the project settings window in IntelliJ to define the project SDK (I don't see this option anywhere else in the global IntelliJ preferences window, this has to be done in the project settings).
I think this error might be caused by an install bug with IntelliJ IDEA. When I look at the installed folder referred to in the error message on my filesystem:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
I see the jre folder but then another jre folder beneath that one which contains the bin and lib folders of the jre:
jre
jre
bin
lib
I copied bin and lib up a level into the first jre folder, and that fixed this error for me.