我在使用工件打开程序时遇到了问题。
所以我制作了一个带有几张图片的JavaFX应用程序。 现在我正在尝试在* .jar文件中启动应用程序,但它不起作用。 我用想法构建了jar文件,并且包含了所有内容。 我在这里遇到了错误:
file:/I:/SDE_ManagingTool/out/artifacts/SDE_ManagingTool_jar/SDE_ManagingTool.jar!/sample/FXML/mainWindow.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.load(Unknown Source)
at sample.Main.start(Main.java:17)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(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$148(Unknown Source)
... 1 more
Caused by: 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 sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
... 13 more
Caused by: java.lang.ExceptionInInitializerError
at sample.Artikel.Amount.getImage(Amount.java:64)
at sample.Controllers.Controller.setPicture(Controller.java:1312)
at sample.Controllers.Controller.setSummaryBestellungTab(Controller.java:1229)
at sample.Controllers.Controller.updateTabPaneBestellung(Controller.java:974)
at sample.Controllers.Controller.selectFirstDataTree(Controller.java:1188)
at sample.Controllers.Controller.loadBestellTreeView(Controller.java:1155)
at sample.Controllers.Controller.loadData(Controller.java:382)
at sample.Controllers.Controller.initialize(Controller.java:368)
... 22 more
Caused by: java.lang.NullPointerException
at sample.Globals.ImageRessources.<clinit>(ImageRessources.java:9)
... 30 more
Exception running application sample.Main
我有一个名为ImageRessources
的类,并且有几行代码如下:
public class ImageRessources {
public static final Image _500DominosImage = new Image(String.valueOf(ImageRessources.class.getResource("../Images/500d.png").toExternalForm()));
}
我只复制了一行,其他图片以同样的方式包含在内。
你能帮助我获得一个可启动的jar文件吗?
问候
达尼