0

I'm trying to create a TornadoFx project in IntelliJ ide.. on build it shows the error

Error: JavaFX runtime components are missing, and are required to run this application

here's the build.gradle file

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.3.40'
    id 'org.openjfx.javafxplugin' version '0.0.7'
}
javafx {
    version = "12"
    modules = ['javafx.controls', 'javafx.base', 'javafx.fxml', 'javafx.graphics']
}
group 'tornado1'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    testCompile group: 'junit', name: 'junit', version: '4.12'
    implementation 'no.tornado:tornadofx:1.7.19'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

and a screenshot of the libraries in the project structure enter image description here

yazan sayed
  • 777
  • 7
  • 24
  • Possible duplicated of this question: [TornadoFX unresolved JavaFx](https://stackoverflow.com/questions/56621095/tornadofx-unresolved-javafx/56622620?r=SearchResults&s=1|78.2973#56622620) – José Pereda Jul 01 '19 at 19:09
  • @JoséPereda i couldn't add " classpath 'org.openjfx:javafx-plugin:0.0.7' " to the dependencies ,, shows error: Could not find method classpath() for arguments [org.openjfx:javafx-plugin:0.0.7] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. – yazan sayed Jul 01 '19 at 19:32
  • You either use `plugins {...}` or `buildscript {...}`, but you can't mix them. – José Pereda Jul 01 '19 at 19:36
  • My gradle does have id 'org.openjfx.javafxplugin' version '0.0.7' and javafx { version = "12" modules = ['javafx.controls', 'javafx.base', 'javafx.fxml', 'javafx.graphics'] } what else is it lacking? – yazan sayed Jul 01 '19 at 19:40
  • Don't you have `mainClassName` in your build.gradle file? In Project Settings, what is the SDK and Language Level? – José Pereda Jul 01 '19 at 19:48
  • SDK 12 , and i tried adding the "application" plugin with the mainClassName ,, but frankly i don't know how to get the full path of the 'App' class ,, is this the missing part ? defining the mainClassName ? – yazan sayed Jul 01 '19 at 19:59
  • To run your project with the JavaFX plugin you definitely need the `application` plugin and also the `mainClassName`, which is just the name of your main class including the package name. – José Pereda Jul 01 '19 at 20:01
  • I tried mainClassName="tornado1.main.MyApp" but still the same error "Error: JavaFX runtime components are missing, and are required to run this application "... also added id 'application' in plugins – yazan sayed Jul 01 '19 at 20:23
  • "> Task :MyApp.main() FAILED Error: JavaFX runtime components are missing, and are required to run this application FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':MyApp.main()'. > Process 'command '/usr/lib/jvm/jdk-12.0.1/bin/java'' finished with non-zero exit value 1" – yazan sayed Jul 01 '19 at 20:26
  • See if you can follow the steps I described in the referred question. It is impossible for me to see what's wrong with your project with what you have posted so far. – José Pereda Jul 01 '19 at 20:30
  • I ended up importing the javaFx jar as local libs in a non-gradle project, and it works fine. but when i try the same in a gradle project, I get the error " Cannot access class 'javafx.scene.Node'. Check your module classpath for missing or conflicting dependencies " I already set up build.gradle to include local jars,,, and I was the one thinking linux dependencies are hard – yazan sayed Jul 02 '19 at 07:19
  • With a gradle project you shouldn't get that issue. Have a look at the docs https://openjfx.io/openjfx-docs/#IDE-Intellij (Gradle sections) and the [samples](https://github.com/openjfx/samples/blob/master/IDE/IntelliJ/Non-Modular/Gradle). When you get that working, add the Tornado part. – José Pereda Jul 02 '19 at 07:58

0 Answers0