Jump to content
Excelsior Forums
Sid

Issues packaging FXML application

Recommended Posts

Hey!

I recently just discovered Excelsior and am giving it a test spin. Love the idea, but I'm currently unable to get my app to start correctly after it's been packaged.

It's a maven project which I'm packaging using the mvn jet:build command.

 

The error:

WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.141
Oct 16, 2018 10:08:47 AM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.141
Exception in Application start method
Exception in thread "main" 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$1(Unknown Source)
        at com.sun.javafx.application.LauncherImpl$$Lambda$37.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: javafx.fxml.LoadException:
file:/C:/Users/joe/Desktop/Test/ca-3.1.1.jar!/ca.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 com.sideramaris.controllers.MainController.start(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(Unknown Source)
        at com.sun.javafx.application.LauncherImpl$$Lambda$237.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$$Lambda$74.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$null$5(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$$Lambda$216.run(Unknown Source)
        at java.security.AccessController.<unknown>(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$$Lambda$62.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$3(Unknown Source)
        at com.sun.glass.ui.win.WinApplication$$Lambda$108.run(Unknown Source)
        ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.misc.Trampoline.invoke(Unknown Source)
        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
        ... 18 more
Caused by: java.lang.RuntimeException: javafx.fxml.LoadException:
file:/C:/Users/joe/Desktop/Test/ca-3.1.1.jar!/player_box/playerBox.fxml

        at com.sideramaris.controllers.PlayerBoxController.<init>(Unknown Source)
        at com.sideramaris.controllers.MainController.initialize(Unknown Source)
        ... 20 more
Caused by: javafx.fxml.LoadException:
file:/C:/Users/joe/Desktop/Test/ca-3.1.1.jar!/player_box/playerBox.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)
        ... 22 more
Caused by: java.lang.RuntimeException: javafx.fxml.LoadException:
file:/C:/Users/joe/Desktop/Test/ca-3.1.1.jar!/player_box/tracker.fxml

        at com.sideramaris.controllers.TrackerController.<init>(Unknown Source)
        at com.sideramaris.controllers.PlayerBoxController.initialize(Unknown Source)
        ... 25 more
Caused by: javafx.fxml.LoadException:
file:/C:/Users/joe/Desktop/Test/ca-3.1.1.jar!/player_box/tracker.fxml

        at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
        at javafx.fxml.FXMLLoader.importClass(Unknown Source)
        at javafx.fxml.FXMLLoader.processImport(Unknown Source)
        at javafx.fxml.FXMLLoader.processProcessingInstruction(Unknown Source)
        at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
        at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
        at javafx.fxml.FXMLLoader.load(Unknown Source)
        ... 27 more
Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.SwingNode
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at javafx.fxml.FXMLLoader.loadTypeForPackage(Unknown Source)
        at javafx.fxml.FXMLLoader.loadType(Unknown Source)
        ... 33 more

 

It works fine when I run it as an executable jar, so I'm wondering what's going on here.

Share this post


Link to post
Share on other sites

Never mind. I solved it. It was just a newbie mistake.

Didn't realize I had to also run JetPackII before distributing my program which was really easy and straightforward to do!

I love this application.

Share this post


Link to post
Share on other sites

Actually, Excelsior JET Maven plugin invokes JetPackII itself (xpack actually -- batch mode packager). So you do not need to run it separately.

In your case "javafx-swing" runtime component should be added via Excelsior JET Maven configuration as described here: https://github.com/excelsior-oss/excelsior-jet-maven-plugin/wiki/Excelsior-JET-Runtime-Configurations#optional-components

To avoid such problems, it is highly recommended to perform Test Run before build to discover required JET Runtime components that are loaded by your application dynamically.

Maven command for Test Run is "jet:testrun"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×