B4J Code Snippet B4j UI in linux

In continuation to this https://www.b4x.com/android/forum/t...el-amd-computers-and-vpss.159928/post-1012091 :

I succesfully use this kind of file to lauch a ui app :
#!/bin/bash
cd /home/[my user]/[all apps folder]/[app folder]
java --module-path /usr/share/openjfx/lib --add-modules javafx.controls,javafx.fxml,javafx.web -jar /home/[my user]/[all apps folder]/[app folder]/myapp.jar
It works for all my apps exect those with custolistview... I had to change for listview.
Important note : file.dirapp is not like in windows, it depends on where the app is actually launched from, that is the reason for the cd line in the file.
To launch the file I use a desktop shortcut that points to the above file wherever it is.
 
Last edited:

Magma

Expert
Licensed User
Longtime User
In continuation to this https://www.b4x.com/android/forum/t...el-amd-computers-and-vpss.159928/post-1012091 :

I succesfully use this kind of file to lauch a ui app :

It works for all my apps exect those with custolistview... I had to change for listview.
Important note : file.dirapp is not like in windows, it depends on where the app is actually launched from, that is the reason for the cd line in the file.
To launch the file I use a desktop shortcut that points to the above file wherever it is.
I am not sure... but i think that you need to add some more modules for custolistview.... swing modules..

also try with newer openjdk... 14... 17..
 

derez

Expert
Licensed User
Longtime User
I am not sure... but i think that you need to add some more modules for custolistview.... swing modules..

also try with newer openjdk... 14... 17..
Running java version 21. I tried to add many other moduels per AI recomendations but it goes to too many other problems.
It is not too important, the listview works well...
 

derez

Expert
Licensed User
Longtime User
I consulted AI again and it gave me this code (after long explanation). The raised problem was measuring the multiline text. :
Bash

/path/to/jdk/bin/java -jar \
--module-path /path/to/javafx/lib \
--add-modules ALL-MODULE-PATH \
-Djdk.gtk.version=2 \
--add-opens javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED \
yourAppName.jar

You won't believe but it works and I can use the cusomlistview !
 

Magma

Expert
Licensed User
Longtime User
I consulted AI again and it gave me this code (after long explanation). The raised problem was measuring the multiline text. :


You won't believe but it works and I can use the cusomlistview !
actually a good start is using: creating standalone exe, then you will see in build folder a "debug.bat" - if you open with notepad, you will see exactly what you need for your jar... if you search it more you will see a "release_java_modules.txt" / if open that you too, you will have clear view what really needs...

But in general is good to try everything...

until now... I have apps running in Ubuntu, MacOS, Windows... with no changes after XUI upgrade!

B4X is a life saver!
 

aeric

Expert
Licensed User
Longtime User
actually a good start is using: creating standalone exe
Yes, standalone exe is for Windows setup.
However, for Linux we will need to create a json file and take the compiled jar then run b4jbuilder in terminal to build a new package on Linux.
From there, we can create a deb package for Debian and create as an Application.
I have my POS running on Linux which I use a lot of CustomListView with no issue.
The module parameters are read from a text file generated by b4jbuilder. No need to create the file in first post.
If you like, you can create a desktop shortcut but Linux DE nowadays don't recommend users to put shortcuts on desktop. :)
 
Top