Trying to call a JavaFX application from Java… NoSuchMethodException

You must provide a constructor with no arguments when you extend application. So you could do something like:

public class SimpleSun extends Application {

    private Stage primaryStage;
    Configuration configuration;

    public SimpleSun() {
        this.configuration = Main.getConfig();
    }
    //...

and in your Main class:

public static Configuration getConfig() { return new ConfigurationFromFile(); }

Alternatively you can pass String parameters to the class with launch(args) and get them back in the SimpleSun class with getParameters().

Leave a Comment