0

In my application from main controller i try to open new scene

public void runReportParserWindow() throws IOException {

    System.out.println("Open report parser window");
    FXMLLoader fxmlLoader = new FXMLLoader();      
    fxmlLoader.setLocation(getClass().getResource("../views/reportWindow.fxml"));
    ControllerReportParser controller = new ControllerReportParser(getPrimaryStage(), getMainApp());
    controller.registerObserver(this);
    fxmlLoader.setController(controller);
    Scene scene = new Scene(fxmlLoader.load());
    Stage stage = new Stage();
    stage.setTitle("Get data for report");
    stage.setScene(scene); //scene
    stage.initModality(Modality.WINDOW_MODAL);
    stage.initOwner(getPrimaryStage());

    stage.show();
}

If i run application in Intellij idea - all window open fine. When i create JAR file (artifacts) i can not open any window except main. The main scene is shown, but other are not. Settings for artifact enter image description here

What am i doing wrong?

Vlad Kn
  • 141
  • 2
  • 13

1 Answers1

1

Thanks a lot James_D I used relative paths for load fxml-files. Now i replace views folder to controllers and change code from

fxmlLoader.setLocation(getClass().getResource("../views/reportWindow.fxml"));

to

fxmlLoader.setLocation(getClass().getResource("views/reportWindow.fxml"));

and all work fine.

Vlad Kn
  • 141
  • 2
  • 13