How do I tell Gradle to use specific JDK version?

前端 未结 17 2158
时光取名叫无心
时光取名叫无心 2020-11-22 12:12

I can\'t figure out to get this working.

Scenario:

  • I have an application built with gradle
  • The application uses JavaFX

What I w

17条回答
  •  渐次进展
    2020-11-22 12:37

    If you are using Kotlin DSL, then in build.gradle.kts add:

    tasks.withType {
        options.isFork = true
        options.forkOptions.javaHome = File("C:\\bin\\jdk-13.0.1\\")
    }
    

    Of course, I'm assuming that you have Windows OS and javac compiler is in path C:\bin\jdk-13.0.1\bin\javac. For Linux OS will be similarly.

提交回复
热议问题