当我在Intellij IDEA中运行代码时FXMLLoader工作,但在构建工件之后却没有

时间:2017-10-01 01:07:25

标签: java intellij-idea jar filenotfoundexception fxmlloader

只有当我将程序作为jar运行时,我才有这种特殊情况。我花了几个小时试图解决这个问题,但没有成功。

我已经尝试在网上找到解决方案,你是我解决这个问题的最后机会。

感谢您提供的任何帮助。

This is my project structure and code snipet where first exception occured.

C:\Users\Gerrix\Desktop>java -jar Provera.jar
    Initialize...
    java.io.FileNotFoundException: count_number.xml (The system cannot find the file specified)
            at java.io.FileInputStream.open0(Native Method)
            at java.io.FileInputStream.open(FileInputStream.java:195)
            at java.io.FileInputStream.<init>(FileInputStream.java:138)
            at sample.Controller.countLimit(Controller.java:309)
            at sample.Controller.timer(Controller.java:213)
            at sample.Controller.initialize(Controller.java:120)
            at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
            at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
            at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
            at sample.Main.showPersonOverview(Main.java:60)
            at sample.Main.start(Main.java:42)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
            at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
            at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(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$148(WinApplication.java:191)
            at java.lang.Thread.run(Thread.java:745)
    java.io.FileNotFoundException: auth.xml (The system cannot find the file specified)
            at java.io.FileInputStream.open0(Native Method)
            at java.io.FileInputStream.open(FileInputStream.java:195)
            at java.io.FileInputStream.<init>(FileInputStream.java:138)
            at sample.TwitterService.initialize(TwitterService.java:49)
            at sample.TwitterService.<init>(TwitterService.java:33)
            at sample.Controller.lambda$initialize$0(Controller.java:111)
            at java.lang.Thread.run(Thread.java:745)
    javafx.fxml.LoadException:
    file:/C:/Users/Gerrix/Desktop/Provera.jar!/sample/sample.fxml

            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 sample.Main.showPersonOverview(Main.java:60)
            at sample.Main.start(Main.java:42)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
            at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
            at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(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$148(WinApplication.java:191)
            at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NullPointerException
            at sample.Controller.countLimit(Controller.java:316)
            at sample.Controller.timer(Controller.java:213)
            at sample.Controller.initialize(Controller.java:120)
            at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
            ... 13 more
    Exception in thread "Thread-5" java.lang.NullPointerException
            at sample.TwitterService.initialize(TwitterService.java:57)
            at sample.TwitterService.<init>(TwitterService.java:33)
            at sample.Controller.lambda$initialize$0(Controller.java:111)
            at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案