ha obtenido un error cuando estoy ejecutando el archivo JAR. IllegalStateException: La ubicación no está establecido

Nyamkhuu Buyanjargal:

Estoy desarrollando JavaFX aplicación con Maven. Puedo ejecutar mi aplicación de la idea Intellij sin excepción y error. Pero me dio error cuando estoy ejecutando el archivo JAR. ¿Cómo resolver esta cuestión?

Creo que, el siguiente excepción conseguido en esa línea:

FXMLLoader loader = new FXMLLoader(this.getClass().getResource("../screen/AdminScreen.fxml"));

¿Ayudame por favor?

Este es mi excepción:

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:

Dado que ..no es un identificador válido de Java, no hay garantía de conseguir de esta resoluble. Pruebe lo siguiente:

FXMLLoader loader = new FXMLLoader(getClass().getResource("/screen/AdminScreen.fxml"))

Alternativamente, el siguiente enlace explica el uso de los recursos de Java: https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html

Supongo que te gusta

Origin http://10.200.1.11:23101/article/api/json?id=478770&siteId=1
Recomendado
Clasificación