IntelliJ Gradle Plugin: The supplied javaHome seems to be invalid

Eric Francis picture Eric Francis · Mar 30, 2015 · Viewed 74.6k times · Source

Similar to:
- Intellij 14 the supplied javaHome seems to be invalid
- Android Studio - supplied javaHome is not a valid folder

However, I am trying to use my JAVA_HOME variable which is set to C:\Program Files\Java\jdk1.8.0_40

I do not understand why intellij is looking for the JDK inside of its install directory.

In intellij:

Executing external task 'bootRun'...
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\jre\bin\java.exe
External task execution finished 'bootRun'.

C:\>java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

C:>env
...
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
...

Answer

humazed picture humazed · Apr 11, 2016

In my case the answers above didn't work. Here's what work for me: I needed to change Gradle JVM to point to the actual JDK: Image showing IntelliJ Settings window