Создание файла Jar вызывает исключение java.lang.IllegalStateException: местоположение не задано. исключение

Я пытаюсь создать кошелек в блокчейне, используя монету флорина. код, который я разработал, отлично работает в eclipse, но когда я получаю экспорт исполняемого файла jar, кошелек не запускается и выдает исключение «java.lang.IllegalStateException: Location is not set». У меня есть две разные программы, а именно - flo-core и flo-wallet. У flo-кошелька есть main.java и MainController.java. Я прикрепляю трассировку стека, пока пытаюсь запустить через банку.

C:\> java -jar flocre.jar

    java.lang.IllegalStateException: Location is not set.
            at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
            at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
            at wallettemplate.Main.realStart(Main.java:87)
            at wallettemplate.Main.start(Main.java:64)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
            at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
            at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
            at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
            at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
            at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
            at java.lang.Thread.run(Unknown Source)
    Exception in Application start method
    Exception in Application stop method
    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: Exception in Application start method
            at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
            at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.IllegalStateException: Location is not set.
            at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
            at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
            at wallettemplate.utils.GuiUtils.runAlert(GuiUtils.java:46)
            at wallettemplate.utils.GuiUtils.lambda$0(GuiUtils.java:61)
            at wallettemplate.utils.GuiUtils.crashAlert(GuiUtils.java:65)
            at wallettemplate.Main.start(Main.java:66)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
            at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
            at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
            at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
            at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
            at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
            ... 1 more

C:> java -jar flocre.jar

rsrc: шаблон кошелька / main.fxml

javafx.fxml.LoadException:
wallettemplate/main.fxml:55

        at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
        at wallettemplate.Main.realStart(Main.java:89)
        at wallettemplate.Main.start(Main.java:64)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
        at wallettemplate.controls.ClickableFLOAddress.<init>(ClickableFLOAddress.java:74)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at sun.reflect.misc.ReflectUtil.newInstance(Unknown Source)
        at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1009)
        at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:746)
        at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
        ... 13 more
Exception in Application start method
Exception in Application stop method
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
        at wallettemplate.utils.GuiUtils.runAlert(GuiUtils.java:46)
        at wallettemplate.utils.GuiUtils.lambda$0(GuiUtils.java:61)
        at wallettemplate.utils.GuiUtils.crashAlert(GuiUtils.java:65)
        at wallettemplate.Main.start(Main.java:66)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        ... 1 more

файл FXML, включенный в файл jar

часть загрузчика

Может ли кто-нибудь помочь мне в этом. Заранее спасибо.


person Sagar    schedule 14.05.2018    source источник
comment
Это проблема с FXMLLoader. В частности, вы передаете null для расположения URL вашего ресурса FXML. Убедитесь, что ваш файл FXML включен в файл JAR, и, если это так, убедитесь, что вы используете правильное имя (включая регистр) в вызове getResource(String).   -  person Slaw    schedule 14.05.2018
comment
Спасибо, Слав. Файл FXMl включен в банку, и дела для файла также верны. Да, местоположение становится нулевым, и обновление вещей по-прежнему возвращает ту же ошибку. Для справки я также добавил снимок файла jar и часть кода.   -  person Sagar    schedule 14.05.2018
comment
Вы проверили фактическое содержимое файла jar (например, с помощью jar -tf ...)? Ваш скриншот просто показывает (я думаю) содержимое исходной папки. В каком пакете находится Main?   -  person James_D    schedule 14.05.2018
comment
Привет, Джеймс, Main находится в /src/main/java/wallettemplate, MainController — в /src/main/java/wallettemplate, а main.fxml — в /src/main/resources/wallettemplate.   -  person Sagar    schedule 14.05.2018
comment
Данная ошибка все еще сохраняется, но не с mail.fxml. Теперь я столкнулся с другой проблемой, и я прошел почти все решения в Интернете, но ничего не помогает. Выкладываю новую ошибку. Пожалуйста помоги.   -  person Sagar    schedule 15.05.2018