java
build_error
ai_generated
true
任务 ':compileJava' 执行失败 > 找不到 tools.jar。请检查 /usr/lib/jvm/java-11-openjdk-amd64 是否包含有效的 JDK 安装。
Execution failed for task ':compileJava' > Could not find tools.jar. Please check that /usr/lib/jvm/java-11-openjdk-amd64 contains a valid JDK installation.
ID: java/gradle-task-execution-failure
80%修复率
85%置信度
0证据数
2024-05-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 8+ | active | — | — | — |
根因分析
Java 主目录路径指向 JRE 而非 JDK,或 JDK 安装不完整。
English
The Java home path points to a JRE instead of a JDK, or the JDK installation is incomplete.
解决方案
-
95% 成功率 Set JAVA_HOME to a proper JDK installation
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 (ensure it points to JDK, not JRE)
-
90% 成功率 Install a full JDK if missing
sudo apt-get install openjdk-11-jdk
无效尝试
常见但无效的做法:
-
Setting JAVA_HOME to a JRE directory
95% 失败
JRE does not contain tools.jar, which is needed for annotation processing or certain plugins.
-
Downloading tools.jar separately and placing it in the JRE lib folder
90% 失败
This is not a supported configuration and may cause compatibility issues.