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
...
Upgrading IntelliJ UE from v14.1.1 to 14.1.7 worked for me.
UPDATE I believe this issue has been fixed as of 14.1.3
Related bug links:
That said, I was able to get by using @Sergii Pechenizkyi's answer; however, it seems like this problem has a few different solutions.
This can be fixed by setting the Project SDK in Module settings to a JDK (as opposed to the Module SDK (which shall be Android SDK)
I encountered the same problem for quite a while and no matter how many forums I looked at it just did not solve the problem.
Long story short, I found out my antivirus quarantined the java.exe file. So I advise you to open your antivirus and restore the Java.exe file then relaunch android studios.
It is not working on the Mac as of 16.3. The SDK was set correctly in Project Settings and the Gradle dialog box no longer allows you to select the JDK. The only solution that worked was creating the gradle.properties file.
I tried this and it worked for me flawlessly. go To SETTING-->SEARCH 'Gradle'---> and choose Gradle JVM and choose the option Use JAVA_HOME C:\ProgramFiles\Java\JDK\1.8 hope this helps someone.