Eric Francis Eric Francis - 3 months ago 99
Java Question

IntelliJ Gradle Plugin: The supplied javaHome seems to be invalid

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

IDEA comes in 2 versions: 32bit and 64bit.

Your JAVA_HOME is 64bit version of Java so you have to run 64bit version of the IDEA ...\IntelliJ\IntelliJ IDEA Community Edition 14.1.2\bin\idea64.exe.

Otherwise, you can provide 32bit JDK or tweak the behaviour with IDEA settings https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under