Whenever I try to do anything with gradle from within Intellij I get an error as follows:
Executing command: "tasks" Failed to connect to gradle process for command 'tasks' ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
But in my environment I have JAVA_HOME
set to the proper JDK in a different directory. Plus when I look in IntelliJ for the project, it also shows the JDK in the proper JDK location. I cannot find anything that attempts to point the JDK to the Intellij JRE location.
Any ideas please?
Do you have Java configured as one of your SDKs in IntelliJ? You don't explicitly require that JAVA_HOME be set if you do.
From the main menu, select File | Project Structure | Platform Settings | SDKs. , select the necessary SDK and specify its home directory in the dialog that opens. Only for JDKs: if you don't have the necessary JDK on your computer, select Download JDK.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With