Gradle cannot find JDK

最后都变了- 提交于 2021-01-27 13:51:26

问题


I've created a gradle project with the following configuration:

group '...'
version '0.0'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

test {
    useTestNG()

    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

When I execute "gradle build" I have the following error message:

Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

This is weird since I have $JAVA_HOME set:

✗ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
✗ $JAVA_HOME/bin/javac
Usage: javac <options> <source files>
where possible options include:

回答1:


I've found a solution.

To fix this issue I simply executed:

./gradlew build

This did the trick.



来源:https://stackoverflow.com/questions/32289233/gradle-cannot-find-jdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!