From e6252961c9bbf63837121ec2101a9103b03c663b Mon Sep 17 00:00:00 2001 From: Tan Wang Leng Date: Mon, 16 Jan 2017 22:20:41 +0800 Subject: [PATCH] [#39] executable jar file doesn't run (#62) When running it in .jar, Java does not allow the use of '\' (Windows file separator), only allows '/' (Unix file separator), in resource filepaths. To ensure that future developers understand the issue, a link to the documentation is provided. --- src/seedu/addressbook/ui/Gui.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/seedu/addressbook/ui/Gui.java b/src/seedu/addressbook/ui/Gui.java index 20a7833c1..ed21989a4 100644 --- a/src/seedu/addressbook/ui/Gui.java +++ b/src/seedu/addressbook/ui/Gui.java @@ -36,7 +36,12 @@ public void start(Stage stage, Stoppable mainApp) throws IOException { private MainWindow createMainWindow(Stage stage, Stoppable mainApp) throws IOException{ FXMLLoader loader = new FXMLLoader(); - loader.setLocation(Main.class.getResource("ui" + File.separator + "mainwindow.fxml")); + + /* Note: When calling getResource(), use '/', instead of File.separator or '\\' + * More info: http://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html#res_name_context + */ + loader.setLocation(Main.class.getResource("ui/mainwindow.fxml")); + stage.setTitle(version); stage.setScene(new Scene(loader.load(), INITIAL_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT)); stage.show();