【问题标题】:Gradle build tools.jar not foundGradle 构建 tools.jar 未找到
【发布时间】:2020-03-15 19:38:30
【问题描述】:

我正在尝试在 RHEL EC2 机器中构建 Spring Boot 应用程序。我在 gradle build 中找不到“tools.jar”

readlink -f $(which java)
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-2.el8_1.x86_64/jre/bin/java

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-2.el8_1.x86_64/jre
echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-2.el8_1.x86_64/jre

但是当我尝试构建时,我遇到了错误

$gradle build
 > Task :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-1.8.0-openjdk-1.8.0.232.b09- 
 2.el8_1.x86_64/jre 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.

【问题讨论】:

  • 你安装的是 jre 而不是 jdk。
  • @ M. Deinum 我安装了 JDK 我应该在导出命令中给出哪个路径?

标签: java spring-boot gradle amazon-ec2 build.gradle


【解决方案1】:

我安装了 jdk 并运行了 $yum install java-1.8.0-openjdk-devel。在此构建成功后使用相同的 jre 路径

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-09
    • 2015-11-06
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    • 2020-03-06
    相关资源
    最近更新 更多