gradle java ide,IntelliJ IDEA Gradle同步:将Gradle的Java主页设置为某些JDK时出现问题

I have no problem with:

org.gradle.java.home=C:/Program Files/Java/openjdk1.8.0_202

in my (global) gradle.properties file. Also, no problem without it (with nothing set). But if replace it with one of below configurations (all paths are valid):

org.gradle.java.home=C:/Program Files/Java/openjdk-9.0.4

org.gradle.java.home=C:/Program Files/Java/openjdk-10.0.1

org.gradle.java.home=C:/Program Files/Java/openjdk-11.0.1

org.gradle.java.home=C:\\Program Files\\Java\\oraclejdk-11.0.1

then I will get an error message (same for each) after I save the file and import Gradle changes in IntelliJ IDEA:

Unable to start the daemon process.

This problem might be caused by incorrect configuration of the daemon.

For example, an unrecognized jvm option is used.

Please refer to the user guide chapter on the daemon at https://docs.gradle.org/5.0/userguide/gradle_daemon.html

Please read the following process output to find out more:

OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0

Error: Could not find or load main class java.base.java.lang=ALL-UNNAMED

Caused by: java.lang.ClassNotFoundException: java.base.java.lang=ALL-UNNAMED

The note is the issue is only for IDE Gradle sync. Gradle tasks themselves work correctly (independent from IDE)! Even when I run gradle --status (see here about it) can see everything is OK and daemon is running using JDK 11:

>gradlew --status

PID STATUS INFO

10668 IDLE 5.0

And the path of PID: 10668:

>wmic process where "processId=10668" get Name, ProcessID, ExecutablePath

ExecutablePath Name ProcessId

C:\Program Files\Java\openjdk-11.0.1\bin\java.exe java.exe 10668

解决方案

Finally, I found out the issue was from my IDE settings. It was from SDK Table.

I don't know why correcting them from Project Structure (or Structure for new Projects in Other Settings) couldn't solve the issue. Finally, I imported it (and only it) from a fresh installation.

Note: You don't need a fresh installation really. Just enough to close your IDE, rename its configuration directory and re-open it.

Then IDE starts freshly. This is an opportunity for the test. If OK export pointed setting ... File -> Export Settings ...:

ow5ZT.png

to a file. Then return to your previous state and import the exported file:

VFGvs.png

If the issue reverted you need to check other settings (other than SDK Table).

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2021 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值