badass-jlink-plugin icon indicating copy to clipboard operation
badass-jlink-plugin copied to clipboard

Broken exe file depending on module name (see #298)

Open armin-reichert opened this issue 6 months ago • 2 comments

I still see very (very) strange behavior of the Plugin (3.1.1, Windows 10).

Some days ago I streamlined the naming of all Java modules in my projects in GitHub repository https://github.com/armin-reichert/pacman-javafx. And guess what? The exe file for the main application (https://github.com/armin-reichert/pacman-javafx/tree/main/pacman-app-allgames) was broken again! The batch script under runtime\bin was working, I also could run the application from my IntelliJ, only the exe file crashed (error dialog box "Could not start JVM").

As I have no clue how to debug what's going on in the .exe file, I added imageOptions = ["--win-console"] inside the jpackage block in build.gradle, started the .exe from the command-line and saw an error message saying, the module would not be part of the boot layer (whatever that means).

And now the very (very) strange part again: After just renaming the Java module, e.g. by prepending "x." to the module name, suddenly the .exe file was working! How can that be?

To validate this, I added the minimal code into another build.gradle to create an installer for the Pac-Man Arcade application, see https://github.com/armin-reichert/pacman-javafx/blob/main/pacman-app-arcade-pacman/build.gradle.

And guess what? The generated.exe was broken! And after just changing the module name from "arcade.pacman" to "x.arcade.pacman" I got a working .exe file again! WTF?

armin-reichert avatar May 13 '25 04:05 armin-reichert

Hi, I have a long backlog for this project and a bunch of other projects (and my day job). I have the idea that thi might be related to another issue, so I'll look into that one first and then see if this also gets fixed. Please be patient. :)

xzel23 avatar May 14 '25 13:05 xzel23

Hi Axel, this has absolutely no priority, so you can address this issue whenever you like. Just wanted to inform you that there still is something fishy with the plugin. Best regards Armin

armin-reichert avatar May 14 '25 14:05 armin-reichert

After a number of updates (improvements with the help of Copilot) of my Gradle scripts, I changed all module names back to "normal" again and created new installers (.msi). And everything worked ok. So far, so good.

Now I did the following: As described in the jpackage documentation, if you don't explicitly specify the installer type ("msi" or "exe", "deb" etc.), jpackage is supposed to create all installers for the platform it runs on, right? So I omit the installer type "msi" in my Windows 10 build and jpackage created an msi-installer as before and also an exe-installer.

Then I ran the exe-installer to test if it works and it crashes. And after that, I could not get a funktioning installer again, neither msi nor exe! Deleting registry key, build folders, Gradle and Maven caches all did not help! The only thing that got me a working msi-installer back was changing the module name in module-info.java and build.gradle. But: Only if I changed the beginning of the module name helped!

For example changing the module name from "de.amr.pacmanfx.allgames" to e.g. "de.amr.pacmanfx.all" did nit help! But changing the module name to "org.amr.pacmanfx.allgames" worked! WTF!

armin-reichert avatar Aug 08 '25 04:08 armin-reichert