java - JavaFX IllegalState Exception when creating Artifact in IntelliJ -


the program builds , runs fine within intellij idea can't find .fxml files when create built jar.

system.err.println(getclass().getresource("/select_mfc_com.fxml"); fxmlloader selectmfccomloader = new fxmlloader(getclass().getresource("/select_mfc_com.fxml")); gascontrolroot.getchildren().add(selectmfccomloader.load()); mselectmfccomcontroller = selectmfccomloader.getcontroller(); mselectmfccomcontroller.setconnectmfcclickedlistener(this); 

i have .fxml files in resource folder, , output jar has them in root of classpath. i've checked jar file , @ root of it.

however when run built .jnlp i'm still getting following error.

null java.lang.illegalstateexception: location not set.     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2434)     @ javafx.fxml.fxmlloader.load(fxmlloader.java:2409)     @ com.aernos.sensingsystem.main.start(main.java:184)     @ com.sun.javafx.applet.fxapplet2$2.run(fxapplet2.java:134)     @ com.sun.javafx.application.platformimpl.lambda$null$173(platformimpl.java:295)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$174(platformimpl.java:294)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95)     @ com.sun.glass.ui.win.winapplication._runloop(native method)     @ com.sun.glass.ui.win.winapplication.lambda$null$148(winapplication.java:191)     @ java.lang.thread.run(unknown source) 

i've tried placing .fxml files in src folder , specifying full path. both methods result in same error , printed resource null when running built file.


Comments