error javafx runtime components are missing and are required to run this application javafx plugin gradle code example

Example: gradle javafx runtime components are missing and are required to run this application

/* 
For example, you can have a main class that is not extending javafx.application.Application,
and that main class can then call the main(String[]) method on your real main class
(that way, the Java launcher doesn't require the javafx libraries to be available as named modules). 
*/

// Like this:
// Your JavaFX Class
public class YourJavaFXApplication extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        // Your JavaFx stuff
    }
}

// Your Main class which only purpose is to start your JavaFX class
public class Main {
    public static void main(String[] args) {
        YourJavaFXApplication.main(args);
    }
}

Tags:

Java Example