Nyamkhuu Buyanjargal :
I am developing Javafx app with maven. I can run my app from Intellij idea without any exception and error. But I got error when I am running Jar file. How to solve that issue?
I think, the below exception got at that line:
FXMLLoader loader = new FXMLLoader(this.getClass().getResource("../screen/AdminScreen.fxml"));
Help me, please?
This is my exception:
Exception in thread "JavaFX Application Thread"
java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at login.LoginController.signInAction(LoginController.java:101)
at login.LoginController.lambda$addListeners$2(LoginController.java:65)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8890)
salsinga :
Since ..
is not a valid Java identifier, there is no guarantee of this getting resolvable. Try following:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/screen/AdminScreen.fxml"))
Alternatively , the following link explains java resources usage: https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=416492&siteId=1