How to use FXMLLoader.load() - JavaFX 2
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());
Try this
Parent root= FXMLLoader.load(getClass().getResource("mention the path to your fxml file");
hope that this would help