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 from 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();
}
}