Closed juananpe closed 2 years ago
Good point. I got your program working by just extending the list of manual_modules like this:
manual_modules=,jdk.crypto.ec,jdk.localedata,java.xml,java.scripting,jdk.unsupported
These additional modules cannot be found by the static analysis because they are used by the FXML reader via reflection.
Oh! It works! Thanks for your promptly answer. I guess that java.xml and java.scripting dependencies were not detected by jdeps, and I should be able to figure out the name of those modules (and add them manual_modules), but how did you know about jdk.unsupported?
I tested your project on my Mac. Therefore I removed the option --strip-native-commands
from the jlink command in the script file build_app_mac.sh
so that I could add the following script as runApp.sh
in the root folder of your project.
#!/bin/bash
target/java-runtime/bin/java \
-cp "target/installer/input/libs/*" \
com.example.packaging.Main
After rebuilding your project I could then launch this script which only depends on whatever the build has created. So, if something is missing I would get an error message. That way I discoverd that javax.xml.stream.XMLStreamException
is missing which is located in java.xml
. After I added that and repeated the procedure I found that javax.script.Bindings
is still missing which resides in java.scripting
. After the next iteration I already got a black window but sun.misc.Unsafe
was still missing which is in jdk.unsupported
.
That's the whole story. Nothing special.
As the problem seems to be resolved I will close the issue.
Thanks! I learned a lot trying to solve this issue and reading your explanations :)
Hi,
First: thanks for setting up and maintaining this project.
Let me explain my problem here. I tried the vanilla JPackageScriptFX and it works perfectly. I have seen that the JavaFX app used in the example just generates its UI programatically (a label, a box, and a scene). I tried to package it in Linux, macOS and Windows and it works. So far so good.
But now, I'm trying to package a JavaFX app that dynamically loads the FXML UI (reading from a .fxml file) It is just a project created following the IntelliJ template (wizard) for a new JavaFX project, nothing fancy. I can run the application from IntelliJ and it works like a charm.
The project is here: https://github.com/juananpe/packaging
Now, when trying to generate the installer, the JPackageScriptFX provided scripts run flawlessly. But, when I try to run the application (double clicking on the app icon, I'm using macOS), it tries to open a window... that is immediately closed. Usually this means that it is throwing some sort of exception so I tried to run it from the terminal. And, as suggested, I got this exception:
I have searched SO trying to guess what is happening there (tried searching for combinations of NoClassDefFoundError, XMLStreamException, jar file, JavaFX), but I couldn't find anything useful. I would really appreciate any help here.