gradle install报错:Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_431 contains a valid JDK installation

作者
2025-02-19阅读 24

1、gradle编译报错

我不是用的ide编译的(因为ide中已经配置了jdk的目录了,所以并不会有问题)。

我是在代码的文件夹下面,使用cmd窗口来执行的命令,报了如下的错误

> Task :common:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':common:compileJava'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_431 contains a valid JDK installation.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 28s

null

2、解决方法

找到gradle.properties文件。加上jdk的目录配置

org.gradle.java.home=C:\Program Files\Java\jdk-1.8



全部评论

头像
乌兔
前端开发
私信
获得点赞 445
文章被阅读 31,261