Intellij idea jar中的Javafx无法打开新场景

Intellij idea jar中的Javafx无法打开新场景,intellij-idea,javafx,Intellij Idea,Javafx,在主控制器的应用程序中,我尝试打开新场景 public void runReportParserWindow() throws IOException { System.out.println("Open report parser window"); FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("../views/report

在主控制器的应用程序中,我尝试打开新场景

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();
}
如果我在Intellij idea中运行应用程序-所有窗口都可以打开。当我创建JAR文件(工件)时,我不能打开除main之外的任何窗口。主场景已显示,但其他场景未显示。 工件的设置


我做错了什么?

非常感谢詹姆斯 我使用相对路径加载fxml文件。 现在,我将视图文件夹替换为控制器,并将代码从

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


所有这些都可以正常工作。

有帮助吗?使用java-jar bla.jar从shell运行jar,很可能会发生异常,您将看到。或者,这个:?first-maybe。我试着去做。
fxmlLoader.setLocation(getClass().getResource("views/reportWindow.fxml"));