Unable to construct Application instance [duplicate]

This question already has an answer here:
Unable to construct javafx.application.Application instance 1 answer
I am trying to launch in my public class an application defined in another class, earning the "Unable to construct Application instance"-Exception.The example (below) is quite minimalistic. What am I missing?---Clues would be very much appreciated.
This question is different than the question
Unable to construct javafx.application.Application instance
as I would like to have the definition of an application and its launch in separate classes.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

public class Main {
    public static void main(String[] args) {
        Application.launch(OKButton.class, args);
    }
}

class OKButton extends Application {
    @Override
    public void start(Stage stage) {
        Button btn = new Button("OK");
        Scene scene = new Scene(btn, 200, 250);
        stage.setScene(scene);
        stage.show();
    }
}

Комментарии

Популярные сообщения из этого блога

What is considered 'insulting a Muslim'? And is it a sin? If so, is it a minor or major scene?