B4J Tutorial Creating Linux DEB-package for GUI B4J app

This tutorial is made for Linux JDK14 set Java + JavaFX for B4J practically, AI suggestions were partially OK only.
The .jar app file is compiled at Windows developer host.


Very important part is the starting line of the GUI app under Linux, here the correct starting line after the DEB-package is already installed:

/usr/lib/myb4japp/jdk14/bin/java -jar --module-path /usr/lib/myb4japp/jdk14/javafx/lib --add-modules ALL-MODULE-PATH -Djdk.gtk.version=2 --add-opens javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED /usr/bin/myb4japp.jar
But more correctly to include into the starting line all the modules that are generated into "release_java_modules.txt" file by building the standalone package (it depends on the libs of your project) on the target platform Linux via B4J-bridge, like:




----------BONUS:------------
If to modify steps 3, 4, 6, 7 - it's possible to use default Java (downloading during .deb installation) with only distributed needed for you JavaFX.

3. Use as lib only javafx folder
4. Use "Depends: default-jre"
6-7. Use short simpler starting line with just "java" and path to the javafx:

But this variant must be installed by apt command as dpkg command - cannot resolve the dependencies:

sudo apt-get install myb4japp.deb
And the .deb file is 3 times smaller without built-in Java for Linux.
 

Attachments

  • TempDownload.png
    10.5 KB · Views: 192
Last edited:

Theera

Expert
Licensed User
Longtime User
I use jdk 19.0.2 , I can do as the same, or not?
 

peacemaker

Expert
Licensed User
Longtime User
Depends on JavaFX version, as i know the GTK2 driver was removed from JavaFX 18, so setting "-Djdk.gtk.version=2" will not help to avoid critical error.
JavaFX 17 maybe OK, it needs to test.
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
JavaFX 17 maybe OK
I have tested:

1) with OpenJDK23 + JavaFX23 messages:

WARNING: A command line option tried to select the GTK 2 library, which was removed from JavaFX.
WARNING: The GTK 3 library will be used instead.
(java:18590): Gtk-CRITICAL **: 22:44:11.478: gtk_window_resize: assertion 'height > 0' failed

2) with OpenJDK23 + JavaFX17 is just:

(java:28299): Gtk-CRITICAL **: 22:47:10.416: IA__gtk_window_resize: assertion 'height > 0' failed

But at both variants - app works OK, no crash !
Just at WSL2 of Win10 the sizable windows are not resizable, at separate Linux Mint21 - all is OK as usual, sizeable.
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
DEB-package for Linux of B4J GIU app can be developed by using ... default Java and any needed for you JavaFX !
I have walked this way with creating .DEB-package with default JRE (v11 for Mint 21) + distributing inside .deb JavaFX17 - and can confirm that B4J app under Linux can work OK.
 
Last edited:

Theera

Expert
Licensed User
Longtime User
DEB-package for Linux of B4J GIU app can be developed by using ... default Java and any needed for you JavaFX !
I have walked this way and confirm that B4J app under Linux can work OK.
Many thanks for your replies.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…