IntelliJ Gradle Plugin: The supplied javaHome seem

2019-01-30 17:28发布

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
...

13条回答
We Are One
2楼-- · 2019-01-30 17:38

Upgrading IntelliJ UE from v14.1.1 to 14.1.7 worked for me.

查看更多
做个烂人
3楼-- · 2019-01-30 17:41

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.

查看更多
爷的心禁止访问
4楼-- · 2019-01-30 17:46

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)

查看更多
成全新的幸福
5楼-- · 2019-01-30 17:49

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.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-01-30 17:51

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.

查看更多
Ridiculous、
7楼-- · 2019-01-30 17:53

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.

查看更多
登录 后发表回答