Kotlin could not find the required JDK tools in the Java installation

前端 未结 5 1684
面向向阳花
面向向阳花 2020-12-20 11:11

When running ./gradlew clean build I get following message:

> Task :compileKotlin FAILED

FAILURE: Build failed with an exception.

* What we         


        
5条回答
  •  时光取名叫无心
    2020-12-20 11:36

    From the data provided, It is sure that java is in the environment path. But, It doesn't confirm that JAVA_HOME is set to a JDK directory. Are you sure JAVA_HOME is not set to /usr/lib/jvm/java-8-openjdk-amd64/jre instead of /usr/lib/jvm/java-8-openjdk-amd64or /usr/lib/jvm/default-java?

    Because, If JAVA_HOME is set, then gradlew will ignore java binary in the PATH and execute $JAVA_HOME/bin/java which in turn will be available in System.getProperty("java.home") which is logged in this exception ( see jarSearchingUtil.Kt )

    Otherwise, You can try declaring JAVA_HOME directly in the gradlew file

提交回复
热议问题