eclipse中指定gradle的java home

Working Directory: /home/user/Desktop/sts-workspace/demo
Gradle User Home: /home/user/Downloads/gradle-4.2.1
Gradle Distribution: Local installation at /home/user/Downloads/gradle-4.2.1
Gradle Version: 4.2.1
Java Home: /usr/lib/jvm/java-8-openjdk-amd64
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: build

:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk-amd64 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.

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

BUILD FAILED in 0s
1 actionable task: 1 executed

eclipse中执行gradle任务报错,java home路劲有问题,手动指定java home 路径

在build.gradle的同级目录下创建gradle.properties文件,.指向真实的jdk路径

org.gradle.java.home=/home/user/java/jdk1.8.0_121

Last updated