I'm trying to do a java fxml exercise but my program keeps crashing at Pane and viewController. I checked with the debugger and it seems it returns null values.
I've checked for uninitialized objects, I wrote the .fxml file path in all kinds of ways and I've tried some of these ideas: JAVAFX - Load fxml with anchorpane inside main fxml; Error in Loading FXML file into Anchor Pane in JavaFX and others but I still haven't figured it out.
If you have any ideas please share them :)
public void start(Stage stg) throws Exception
{
stg.setTitle("First FXML");
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/PbFXML/src/Controller/first.fxml"));
Pane pane = (Pane)loader.load(); --here
viewController ctr = loader.getController(); --here
ctr.setService(getService());
Scene sc = new Scene(pane);
stg.setScene(sc);
stg.show();
}