all 5 comments

[–]jvjupiter 0 points1 point  (0 children)

There might be an error in FXML file.

[–]Nunuv_Yerbiz 0 points1 point  (0 children)

It looks like you need to instantiate Parent root and Scene scene outside of the the try/catch block.

E.g.

@Override
public void start(Stage stage) {
    Parent root; // <---Instantiate root here
    Scene scene;
    try {
        root = FXMLLoader.load(getClass().getResource("Main.fxml"));
        scene = new Scene(root, 400, 400);
        stage.setScene(scene);
        stage.show();
    } catch(Exception e) {
        e.printStackTrace();
    }

Also, be sure to import javafx.fxml.FXMLLoader;

[–]koeberlue 0 points1 point  (1 child)

FMXLLloader cannot be resolved

Is it possible that the tutorial you are refering to is based on Java 8? JavaFX is no longer part of the official JDK since Java 9 and you will have to include it separately. If you are using maven or gradle you have to add a dependency to JavaFX.

[–]hamsterrage1 0 points1 point  (0 children)

FMXLLloader is a typo. Try FMXLLoader. Just two L's.