1

I am trying to create a wallet in blockchain using florin coin. the code that I designed is working fine and good in eclipse, but when I get the export the executable jar file, the wallet doesn't start and it throws the exception "java.lang.IllegalStateException: Location is not set." I have got two different programs namely - flo-core & flo-wallet. The flo-wallet has the main.java and the MainController.java. I am attaching the stack-trace while I try running via jar.

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:wallettemplate/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 file included in the jar file

loader part

Can anyone please help me out in this. Thank you in advance.

Sagar
  • 23
  • 5
  • 1
    This is an issue with the `FXMLLoader`. Specifically, you are passing `null` for the location of your FXML resource's `URL`. Make sure your FXML file is included in the JAR file and, if it is, make sure you are using the correct name (including case) in the `getResource(String)` call. – Slaw May 14 '18 at 09:38
  • Thank you Slaw. The FXMl file is included in the jar and the cases for the file is also true. Yes, the location is coming as null and updating the things are still returning the same error. For reference I have also added the snapshot of the jar file and the part of the code. – Sagar May 14 '18 at 10:31
  • Did you check the actual content of the jar file (e.g. with `jar -tf ...`)? Your screenshot just shows (I think) the content of a source folder. What package is `Main` in? – James_D May 14 '18 at 11:10
  • Hi James, Main is in /src/main/java/wallettemplate, MainController is on /src/main/java/wallettemplate and main.fxml is in /src/main/resources/wallettemplate. – Sagar May 14 '18 at 11:43
  • The given error is still persistant but not with the mail.fxml. Now I am faceing another issue, and I have gone through almost all the solutions on the internet but nothing is helping. I am posting the new error. Please help. – Sagar May 15 '18 at 11:41

0 Answers0