I have a javafx GUI application and created an executable .jar using shadowJar which works as intended when ran. The program uses Firebase to access the real-time database feature. however, once I wrap the .jar as an .exe using Launch4j, it seems that the program is not able to communicate with Firebase and pretty much looses all functionality. I've spent a lot of time trying to get the .jar to run in .exe, but once I eventually was able to, the program does not work. I am pretty much lost in what I should do in order to fix this problem.
Asked
Active
Viewed 96 times
0
-
why create the exe in the first place? a jar already is an executable. creating an exe will just limit it to a Windows environment – Stultuske May 15 '22 at 16:26
-
1Packaging a JavaFX app as a fat jar via shadowJar is not a supported configuration. See the [packaging resources in the JavaFX tag](https://stackoverflow.com/tags/javafx/info) for recommended alternatives. – jewelsea May 15 '22 at 17:03
-
2@Stultuske Typically, the recommended way to deploy a JavaFX application these days is by creating a self-contained application. This is because JavaFX 11+ is not present in most JDKs that people have installed. Although a fat/uber JAR will work currently, JavaFX "prefers" to be loaded as named modules which is not possible out-of-the-box when packaged as a fat/uber JAR. That's where `jlink` comes into play. And since `jlink` output is platform-specific, you might as well make it nice for your users and use `jpackage` (or some other tool) to create a native installer/executable. – Slaw May 15 '22 at 17:51
-
1Also, JavaFX itself is platform-specific (or, at least, its native code is). – Slaw May 15 '22 at 17:52
-
@Slaw I have been trying to work with jpackage/jlink and have not had any luck, mainly just with the way I have my project setup. The shadowJar .jar I have works perfectly, it just poops out when I wrapped it into a .exe. – Nick May 15 '22 at 20:58
-
Please provide enough code so others can better understand or reproduce the problem. – Community May 15 '22 at 21:30