java.lang.NoSuchMethodException错误(布局)

java.lang.NoSuchMethodException错误(布局),java,Java,我想在另一个窗口中显示另一个布局,但每当我向start方法添加新布局时 BorderPane sch = new BorderPane(); sch.setCenter(addVBox2(primaryStage)); scene1 = new Scene(sch, 800, 500); 我得到这个错误 应用程序启动方法中的异常 Exception in thread "main" **java.lang.NoSuchMethodException**: sample.Main.main([L

我想在另一个窗口中显示另一个布局,但每当我向start方法添加新布局时

BorderPane sch = new BorderPane();
sch.setCenter(addVBox2(primaryStage));
scene1 = new Scene(sch, 800, 500);
我得到这个错误

应用程序启动方法中的异常

Exception in thread "main" **java.lang.NoSuchMethodException**: sample.Main.main([Ljava.lang.String;)
    at java.lang.Class.getMethod(Class.java:1786)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:119)
代码中的问题可能在哪里?谢谢你事先的帮助

public void start(Stage primaryStage) throws IOException {

        stage = primaryStage;

        BorderPane border = new BorderPane();
        border.setLeft(addVBox(primaryStage));
        border.setCenter(addGridPane(primaryStage));
        border.setRight(addDatePicker(primaryStage));
        HBox hbox = addHBox();
        border.setBottom(hbox);

        scene = new Scene(border, 800, 500);




        BorderPane sch = new BorderPane();
        sch.setCenter(addVBox2(primaryStage));
        scene1 = new Scene(sch, 800, 500);

        stage.setScene(scene);
        stage.setTitle("Booking Form");
        stage.show(); 
}



private VBox addVBox2(Stage stage) {

    javafx.scene.control.Label label = new javafx.scene.control.Label("Choose rooms' schedule");
    label.setFont(javafx.scene.text.Font.font("Tahoma", FontWeight.BOLD, 16));
    room1 = new RadioButton("Room 1 of type 1");
    room1.setSelected(true);
    room2 = new RadioButton("Room 2 of type 1");
    room3 = new RadioButton("Room 1 of type 2");
    room4 = new RadioButton("Room 2 of type 2");
    room5 = new RadioButton("Room 1 of type 3");
    room6 = new RadioButton("Room 2 of type 3");





    VBox buttons2 = new VBox(20, label, roomtype1, roomtype2);
    buttons2.setAlignment(Pos.CENTER);
    buttons2.setMaxWidth(225);

    stackPane.getChildren().add(buttons2);

    ToggleGroup toggleGroup = new ToggleGroup();
    toggleGroup.getToggles().addAll(roomtype1, roomtype2);

    Scene scene = new Scene(stackPane, 400, 200);
    stage.setTitle("RadioButton control");

    stage.setScene(scene);
    stage.show();

    return buttons2;
}


private HBox addHBox() {

    HBox hbox = new HBox();
    hbox.setPadding(new Insets(15, 12, 15, 12));
    hbox.setSpacing(10);   // Gap between nodes
    hbox.setStyle("-fx-background-color: #336699;");
    hbox.setAlignment(Pos.CENTER);
    final Text actionTarget = new Text();



       Button schedule = new Button("Schedule");
        schedule.setPrefSize(100, 20);
        schedule.setOnAction(e -> stage.setScene(scene1));

...}
此错误意味着找不到主类。当您出现此类错误时,大多数情况下意味着您将主类从一个文件移动到另一个文件,而不更改运行配置。

在intellij IDE中编辑跑步配置。您的运行配置似乎指向了错误的类

此错误意味着找不到主类。当您出现此类错误时,大多数情况下意味着您将主类从一个文件移动到另一个文件,而不更改运行配置。

在intellij IDE中编辑跑步配置。您的运行配置似乎指向了错误的类

您没有main方法main(字符串[])您没有main方法main(字符串[])
Exception in thread "main" java.lang.NoSuchMethodException: Main.main([Ljava.lang.String;)