FXML - Jar到.exe失败

时间:2015-03-23 21:40:14

标签: java javafx

我发现了几个类似的问题,但我找不到真正的解决方案来解决这个问题,所以我问世界是否有人解决了这个JavaFX问题?

我尝试使用多个转换器软件从我的JavaFX项目(.jar文件)中生成.exe但是我收到了所有这些错误消息(如下所示)如果我打开它,如果.jar文件正常工作会导致这种情况?

(我的文件层次结构是这样的:)

-/lib/derby.jar                                            (set as Native)
-/lib/derbyclient.jar                                      (set as Native)
-/lib/derbynet.jar                                         (set as Native)
-/lib/itextpdf-5.5.5.jar                                   (set as Native)
-/lib/jfxtras-labs-samples-8.0-r4-SNAPSHOT-shadow.jar      (set as Native)
-Utiokos.jar(with the main class)                      (set as Main)

转换后从.exe开头得到的错误消息:

java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(Unknown Source)
at com.sun.javafx.application.LauncherImpl$$Lambda$1/15539988.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Caused by: javafx.fxml.LoadException: 
file:/C:/Users/MrFireman/AppData/Local/Temp/e4jB580.tmp_dir1427146294/Utiokos.jar!/Utiokos/Foablak.fxml

at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at Utiokos.Utiokos.start(Utiokos.java:27)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(Unknown Source)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/20813951.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/2077920.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/29246076.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/17481965.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/28810240.run(Unknown Source)
... 1 more
Caused by: java.lang.NullPointerException
at Utiokos.AdatbazisKapcsolat.aktivNev(AdatbazisKapcsolat.java:228)
at Utiokos.FoablakController.initialize(FoablakController.java:2547)
... 23 more

1 个答案:

答案 0 :(得分:1)

解决方案不仅是将/lib/xy.jar添加为Native,还将其作为类路径添加!

这样一切都在.exe中正常运行! ;)