Wish B4JPackager: Use jpackage with JavaFX 14+

LWGShane

Well-Known Member
Licensed User
Longtime User

OliverA

Expert
Licensed User
Longtime User
there is a new tool called jpackage

I just discovered this tool on Monday and here are some discoveries I made:
1) The JDK 14 version of jpackage is in the incubator stage (note: jpackage is part of the JDK, not JavaFX)
2) The JDK 16 version of jpackage seems to be production ready
3) One can use the JDK 16 version of jpackage to build installers of JDK 11 and JDK 14 runtimes
4) B4JPackager11 (and the Build Standalone Package tool in the B4J IDE when using JDK11 or JDK14) create a .jar file and an app-image that can be used by the jpackage tool to create the installer
5) B4JPackager11 needs to run on the OS on which you want to create the installer. The created app-image is OS specific (the .jar file is not)
6) For example, these are the steps for creating a Windows and Linux installer for a project (steps a through c happen on Windows):

a) Create a standalone version of the B4JPackater11
b) Run the B4J Build Standalone Package on Windows to create the project's .jar file and the windows specific app-image (located in Objects\temp\build)
c) To create the Windows installer, use jpackage, the project's .jar file and the app-image
d) To create a Linux installer
  1. Make sure you have the same JDK installed that was used to create your project's .jar file
  2. Make sure you have JDK 16 installed
  3. Copy the project's .jar file and the B4JPackager11.jar file to the Linux machine. Also copy the packager.json file that the B4J IDE created when running the Build Standalone Package option. It should be located in the Objects folder
  4. Edit the packager.json file to adjust the location of the project's .jar file
  5. Using the same JDK that the project's .jar file was generated with, run the B4JPackager11.jar file using the packager.json file as the input file
  6. This should create a temp folder. In the temp folder, there should be a build folder. This build folder is the "app-image"
  7. Use the JDK 16 jpackage, the project .jar file and the now platform specific app-image and any jpackage options to generate your installer for Linux
7) jpackage has a bunch of options (many of which I've not yet played with). On top of the non-platform (OS-wise) options, each platform has a handful of options specific to it.
8) It could be that for some, the installer options provided by jpackage are limited. But I think for a great many projects, jpackage may just be good enough
9) I do not have any Macs to test this on. Also, there may be issues with Macs running the installer (see https://www.b4x.com/android/forum/threads/macbook-m1.130378/)
10) It would be really nice if jpackage would become an additional option for the B4JPackager11.
So +1000 on this wish for me.
 
Top