Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find JavaFX Packager Tools

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.

like image 731
fikr4n Avatar asked Dec 19 '25 09:12

fikr4n


1 Answers

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.

  1. Find default Java home
    • For Mac: run /usr/libexec/java_home
  2. Set Android Studio JDK to that
    • Go to File > Project Structure
    • Click SDK Location
    • Uncheck Use embedded JDK (recommended)
    • Fill the text box with system default Java home, for example /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home.

Unfortunately, this setting affects all projects instead of specific (currently opened) project.

like image 104
fikr4n Avatar answered Dec 21 '25 03:12

fikr4n



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!