Skip to content

Commit

Permalink
[nus-cs2103-AY1718S1#39] executable jar file doesn't run (nus-cs2103-…
Browse files Browse the repository at this point in the history
…AY1718S1#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.
  • Loading branch information
yamgent authored and damithc committed Jan 16, 2017
1 parent 3512c49 commit e625296
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/seedu/addressbook/ui/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e625296

Please sign in to comment.