openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
354 stars 62 forks source link

NoClassDefFoundError: javafx/application/Application #131

Open Jimmeh94 opened 2 years ago

Jimmeh94 commented 2 years ago

Hi there. I'm getting an NoClassDefFoundError: javafx/application/Application exception being thrown.

My build.gradle is here

plugins {
    id 'java'
    //id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.13'
}

repositories {
    mavenCentral()
}

/*application {
    mainModule = 'com.playarcanum.workzone.client.gui'
    mainClass = 'com.playarcanum.workzone.client.gui.WorkzoneGUI'
}*/

javafx {
    version = '17.0.1'
    modules = ['javafx.controls', 'javafx.fxml']
}

I was thinking that maybe I was running the wrong Gradle task, but it seems like the only JavaFX-related task is "configJavafxRun". Any help is greatly appreciated!

zapek commented 1 week ago

Same here but only when upgrading to 0.1.0. Fine with 0.0.14.

danielpeintner commented 1 week ago

Is it related to https://github.com/openjfx/javafx-gradle-plugin/issues/169#issuecomment-2074869475 ?

Do you need to add 'javafx.base' and others in modules ? Maybe it helps...

zapek commented 1 week ago

@danielpeintner I already tried but it doesn't change anything, unfortunately.

The project is https://github.com/zapek/Xeres Requires JDK 21, changing the javafxplugin version in ui/build.gradle to 0.1.0 and running the 'bootRun' task.

But it's becoming quite a complex project (JavaFX + Spring Boot) so I can understand if you don't want to try it. I know Spring Boot doesn't play well with JPMS which is why I don't use modules. I tried all suggestions in the readme but they don't help.