I am trying to create JavaFX project with Gradle. This is the build.gradle:
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "kotlin"
apply from: "http://dl.bintray.com/content/shemnon/javafx-gradle/8.1.1/javafx.plugin"
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile "org.jetbrains.kotlin:kotlin-reflect"
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
compile "no.tornado:tornadofx:1.7.15"
}
kotlin {
experimental {
coroutines 'enable'
}
}
compileKotlin {
kotlinOptions.jvmTarget = 1.8
}
However I get "Error:Could not find JavaFX Packager Tools, please set one of [jfxrtDir in Gradle Properties, JFXRT_HOME in System Environment, JAVA_HOME in System Environment, java.home in JVM properties]". I've set the Java home, it doesn't change anything. Please help me.
Finally I found the problem and the solution. To compile this project, I use Android Studio which by default has bundled JDK. It seems the embedded JDK doesn't contain JavaFX, so that I change it to system default JDK.
/usr/libexec/java_home/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home. Unfortunately, this setting affects all projects instead of specific (currently opened) project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With