I am building a JavaFX application using the JavaFX Scene Builder. The interface was created in the Scene Builder and a FXML file (main.fxml) was created.
To use the
Try this
Parent root= FXMLLoader.load(getClass().getResource("mention the path to your fxml file");
hope that this would help
Due to a variety of entities eligible to be loaded through FXML you need to state the expected type yourself.
Parent page = FXMLLoader.<Parent>load(MainWindowController.class.getResource("main.fxml").toExternalForm());