This is my main class for running a simple frame have been created by JavaFX but I got this error
Exception in Application start method Exception in thread "main"
java.lang.NoSuchMethodException: controller.TestFrame.main([Ljava.lang.String;)
at java.lang.Class.getMethod(Class.java:1786)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:119)
public class TestFrame extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Frame1 Title");
primaryStage.setScene(
new Scene(
(Parent) FXMLLoader.load(getClass().getResource("/view/Frame1.fxml"))
, 400
, 500));
primaryStage.show();
}
}
main(), so why are you confused when it says that no such method exists? Did you try the JavaFX Hello World program in the documentation? You know, to see how it works.main()method. Sample "Hello World" program has amain()method. So, perhaps you should have amain()method? Or start the program another way? --- If adding amain()method gives you other errors, it's probably because those errors are there now, and when it gets past the first error, the others will occur. Don't blame themain()method for that.