0

I have a Fat Jar JavaFX application. Java 17, JavaFX 18. The jar is built using the maven shade plugin. It's a modular application.

When I try to start it with java -jar fat.jar, I get this error:

Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found

This works fine on both Mac and Windows.

I'm using the JavaFX plugin for maven, so if I run it using mvn javafx:run, the app starts up fine.

I'm using JavaFX from maven dependencies, rather than having it part of the JDK, so the FX jars and libs are part of my fat jar. I don't think it's an installation issue per se, but I don't know.

That said, when maven runs it, it runs it as a single java command with a large module/classpath from the repository files. So that start is certainly different.

How can I get my fat jar to run properly on Ubuntu?

Edit:

This turned out to be a mistake on my part. My shaded jar was not being rebuilt, and it was instead using the one that was originally from my Mac, and that is why it was failing. After I got the jar to correctly rebuild, it worked as expected.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
  • 2
    "_I have a Fat Jar JavaFX application ... It's a modular application_" – Just want to point out that is arguably an oxymoron. The JAR specification does not allow for multiple modules in a single JAR file and launching with the `-jar` option puts everything on the class-path. – Slaw Jul 28 '23 at 18:31
  • 2
    That said, does your fat JAR contain the native JavaFX code for Linux platforms? – Slaw Jul 28 '23 at 18:33
  • 1
    What kind of linux system is it? Which ubuntu version? Intel? Arm? 32bit? 64bit? What is in your pom.xml? Please provide a complete pom.xml that replicates your issue as a [mcve], it does not need to be your exact project pom.xml, just something that is complete that somebody can use to replicate this. Also, provide the build and execution commands you used to create the package and execute it. Check out [Maven Shade JavaFX runtime components are missing](https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing), in case you have not already done so. – jewelsea Jul 28 '23 at 20:18
  • See also this recent review of [_packaging_ and _deployment_](https://stackoverflow.com/a/76758560/230513). – trashgod Jul 28 '23 at 21:47
  • @Slaw yea, I haven't pursued the "how to properly package a modular JFX program" yet. jpackage "seems" to work with the fat jar, but it does throw the warning about running unnamed modules. It's not clear to me how to package a modular application whether it's FX or not, frankly. Fat Jars seemed to be passé now. I want to use jpackage so folks can download a simple installer. – Will Hartung Jul 28 '23 at 22:53
  • @trashgod (and jewelsea) thanks for that link. – Will Hartung Jul 28 '23 at 22:54
  • "*I want to use jpackage so folks can download a simple installer.*" -> if that is what you want, then start with that, rather than trying to create a fat jar (IMO). The best overview for that is IMO [the official Oracle jpackage guide](https://docs.oracle.com/en/java/javase/20/jpackage/packaging-overview.html#GUID-C1027043-587D-418D-8188-EF8F44A4C06A). Note that there are quite a few tricks in using jpackage (e.g. on Mac it appears to require a paid Apple developer signing certificate), so be prepared for to spend time and frustration, and prototype using it to make sure it is what you want – jewelsea Jul 28 '23 at 23:31
  • The [ackman jpackage maven plugin](https://github.com/Akman/jpackage-maven-plugin) can be used to package your app using maven (as that seems to be your chosen pipeline), but as you are running builds targeting multiple platforms, it is a bit tricky. You will need to run the build on each target platform to get an installer for each (don't forget that M1 and Intel macs are different platforms, as are 32 bit vs 64 bit architectures and Intel vs Arm linux distros). [JPackageScriptFX](https://github.com/dlemmermann/JPackageScriptFX) may help (I haven't used it). – jewelsea Jul 28 '23 at 23:35

0 Answers0