B4J Question B4J Packager11 and Raspberry Pi - problem with Release

DarkoT

Active Member
Licensed User
Hi guys... Need little help...
I need to install GUI app on Raspberry Pi ver 4. I installed Bellsoft java 11 (which include javaFx modules). I want to use B4J packager11 for creating release app... Bridge working perfect, I can connect to raspberry - picture below:

1649752258087.png


But - when i run B4J (with connection on Rasperry PI) the system starts to creating jar, after I received a error... Picture:

1649752331263.png

I research all of web and can not find any solution regarding the error... Need I insall some JavaFX modules or?

Please, need help...

Tnx, Darko
 

aeric

Expert
Licensed User
Longtime User
Are you using the external tool to build the package from the json file?
 
Upvote 0

DarkoT

Active Member
Licensed User
Are you using the external tool to build the package from the json file?
@aeric: No, i'm using external B4j Project - B4JPacker11... Should I try with integrated B4JPackager11?
Basicaly - I need to create jar for raspberryPi (=Linux); this work perfectly on other linux machines, but not on raspberry PI... (need to solve a problem with desktop app for Raspberry)...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I haven’t tried with raspberry pi. I just got my rpi today and haven’t found an SD card to install an OS.
I saw this is quite an old thread maybe you can try to install the version recommended by Erel.
 
Upvote 0

DarkoT

Active Member
Licensed User
I haven’t tried with raspberry pi. I just got my rpi today and haven’t found an SD card to install an OS.
I saw this is quite an old thread maybe you can try to install the version recommended by Erel.
@aeric, thank you for help... I'm aready read all this documents in Forum and I can not find any solution which is related to JFX... Do you think - I need to install clasical JFX for Java11 for Linux? I'm still using Bellsoft liberica JDK...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Have you tried this solution?
 
Upvote 0

DarkoT

Active Member
Licensed User
Have you tried this solution?
Yes, I tryed most everything... I'm sure the problem is in B4JPackager11 (as @Erel described - This will work only with OpenJdk11 (while system expects folders like JFX)...


Error:
Folder not found: /usr/lib/jvm/bellsoft-java11-full-arm32-vfp-hflt/bin/../javafx/javafx-jmods

I try to change the javafx folder to existing javafx mods folder and this works, but - I'm getting next error:

Error: Module dio contains package jdk.dio.generic, module jdk.dio exports package jdk.dio.generic to dio

maybe will somebody find out what can be done; I give up... :(
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
Hi @DarkoT ,
Are you able to run in Debug Mode with B4J-Bridge?

I tried but my VNC Viewer screen freeze.

1650343891248.png


WARNING: Unknown module: javafx.swing specified to --add-opens
~e:
WARNING: Unknown module: javafx.swing specified to --add-opens
WARNING: Unknown module: javafx.swing specified to --add-opens
WARNING: package com.sun.glass.ui.win not in javafx.graphics
WARNING: package com.sun.prism.d3d not in javafx.graphics
WARNING: Unknown module: javafx.swt specified to --add-opens
WARNING: Unknown module: javafx.swing specified to --add-opens
Exception in thread "Event Thread"
java.lang.NullPointerException
at javafx.graphics/com.sun.glass.ui.monocle.X11Cursor.<init>(X11Cursor.java:52)
at javafx.graphics/com.sun.glass.ui.monocle.X11WarpingCursor.<init>(X11WarpingCursor.java:31)
at javafx.graphics/com.sun.glass.ui.monocle.X11Platform.createCursor(X11Platform.java:67)
at javafx.graphics/com.sun.glass.ui.monocle.NativePlatform.getCursor(NativePlatform.java:92)
~e:
at javafx.graphics/com.sun.glass.ui.monocle.MouseInput.setState(MouseInput.java:128)
~e:
at javafx.graphics/com.sun.glass.ui.monocle.MonocleApplication.staticScreen_getScreens(MonocleApplication.java:235)
at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
at java.base/java.lang.Thread.run(Thread.java:834)
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Now I follow this solution by @Bruce McGregor :

I am able to run in Debug mode.

Download Linux ARM Full version.

Download.png


Extract.png


Hello-World.png


Debug.png


Commands:
Bash:
pi@raspberrypi:~ $ cd /usr/
pi@raspberrypi:/usr $ sudo mkdir java
pi@raspberrypi:/usr $ cd /home/pi/Downloads/
pi@raspberrypi:~/Downloads $ sudo cp bellsoft-jdk11.0.14.1+1-linux-arm32-vfp-hflt-full.tar.gz /usr/java
pi@raspberrypi:~/Downloads $ cd /usr/java
pi@raspberrypi:/usr/java $ sudo tar -xf bellsoft-jdk11.0.14.1+1-linux-arm32-vfp-hflt-full.tar.gz
pi@raspberrypi:/usr/java $ sudo update-alternatives --install /usr/bin/java java /usr/java/jdk-11.0.14.1-full/bin/java 1000
update-alternatives: using /usr/java/jdk-11.0.14.1-full/bin/java to provide /usr/bin/java (java) in auto mode
pi@raspberrypi:/usr/java $ sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.14.1-full/bin/javac 1000
update-alternatives: using /usr/java/jdk-11.0.14.1-full/bin/javac to provide /usr/bin/javac (javac) in auto mode
pi@raspberrypi:/usr/java $ java -version
openjdk version "11.0.14.1" 2022-02-08 LTS
OpenJDK Runtime Environment (build 11.0.14.1+1-LTS)
OpenJDK 32-Bit Server VM (build 11.0.14.1+1-LTS, mixed mode)
pi@raspberrypi:/usr/java $ javac -version
javac 11.0.14.1
 
Last edited:
Upvote 0

DarkoT

Active Member
Licensed User
Now I follow this solution by @Bruce McGregor :

I am able to run in Debug mode.

Download Linux ARM Full version.

View attachment 128083

View attachment 128086

View attachment 128087

View attachment 128088

Commands:
Bash:
pi@raspberrypi:~ $ cd /usr/
pi@raspberrypi:/usr $ sudo mkdir java
pi@raspberrypi:/usr $ cd /home/pi/Downloads/
pi@raspberrypi:~/Downloads $ sudo cp bellsoft-jdk11.0.14.1+1-linux-arm32-vfp-hflt-full.tar.gz /usr/java
pi@raspberrypi:~/Downloads $ cd /usr/java
pi@raspberrypi:/usr/java $ sudo tar -xf bellsoft-jdk11.0.14.1+1-linux-arm32-vfp-hflt-full.tar.gz
pi@raspberrypi:/usr/java $ sudo update-alternatives --install /usr/bin/java java /usr/java/jdk-11.0.14.1-full/bin/java 1000
update-alternatives: using /usr/java/jdk-11.0.14.1-full/bin/java to provide /usr/bin/java (java) in auto mode
pi@raspberrypi:/usr/java $ sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.14.1-full/bin/javac 1000
update-alternatives: using /usr/java/jdk-11.0.14.1-full/bin/javac to provide /usr/bin/javac (javac) in auto mode
pi@raspberrypi:/usr/java $ java -version
openjdk version "11.0.14.1" 2022-02-08 LTS
OpenJDK Runtime Environment (build 11.0.14.1+1-LTS)
OpenJDK 32-Bit Server VM (build 11.0.14.1+1-LTS, mixed mode)
pi@raspberrypi:/usr/java $ javac -version
javac 11.0.14.1
Oo... That's sound very optimistic... I will try and give you echo on your sugestion... ;)
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I ran into same error when creating release.
I am running 32bit Raspberrypi OS on Raspberry Pi 4B and using 32bit Belsoft Liberica OpenJDK 11.0.14. If I am not mistaken, B4JPackager11 requires 64bit Java.

Bash:
pi@raspberrypi:/usr/java/jdk-11.0.14.1-full/bin $ java -jar tempjars/B4JPackager11.jar tempjars/packager.json
B4JPackager11 Version 1.21
Exe name: WebAPIClient.exe
InputJar: /usr/java/jdk-11.0.14.1-full/bin/tempjars/WebAPIClient.jar
Folder not found: /usr/java/jdk-11.0.14.1-full/bin/../javafx/javafx-jmods
 
Upvote 0

DarkoT

Active Member
Licensed User
I ran into same error when creating release.
I am running 32bit Raspberrypi OS on Raspberry Pi 4B and using 32bit Belsoft Liberica OpenJDK 11.0.14. If I am not mistaken, B4JPackager11 requires 64bit Java.

Bash:
pi@raspberrypi:/usr/java/jdk-11.0.14.1-full/bin $ java -jar tempjars/B4JPackager11.jar tempjars/packager.json
B4JPackager11 Version 1.21
Exe name: WebAPIClient.exe
InputJar: /usr/java/jdk-11.0.14.1-full/bin/tempjars/WebAPIClient.jar
Folder not found: /usr/java/jdk-11.0.14.1-full/bin/../javafx/javafx-jmods
I follow yours instructions and now I can run the project (jar). But still I have a problem with B4jPackager and as you already secribed - I'm sure that is problem with java 64 bit and B4jPackager...

When I run B4j over bridge, I receive still error:

1650354261193.png


In worst case I will create bash script to install all needet java jars to every raspberry pi machine and run created jar (without making the installation)... This will be most easyest way...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Ya, I also get the same error as yours.

Bash:
Error: Modules dio and jdk.dio export package jdk.dio.power to module jrt.fs

Something related to jdk.dio that I can't find any solution yet.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
In case anyone has encountered the following error using Bellsoft Liberica Full JDK 11.0.14.1+1 ARM 32 bit for Linux:
B4X:
Folder not found: /usr/java/jdk-11.0.14.1-full/bin/../javafx/javafx-jmods

Modify B4JPackager11 source code as:
B4X:
Sub AppStart (Args() As String)
    ...
   
    Java14 = Ver.StartsWith("14")
    'JavafxJmods = ReplaceSlashes(File.Combine(java, "..\javafx\javafx-jmods"))
    'JavaFXLibs = ReplaceSlashes(File.Combine(java, "..\javafx\lib"))
    JavafxJmods = ReplaceSlashes(File.Combine(java, "..\jmods"))
    JavaFXLibs = ReplaceSlashes(File.Combine(java, "..\lib"))
   
    ...
End Sub
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
I think I found a solution.
Delete (or rename) the following files inside /usr/java/jdk-11.0.14.1-full/lib:
dio.jar
jrt-fs.jar

Then run B4JPackager11.jar

Voila! It compiles!
Not sure it is a correct way but at least I can compile the jar using B4JPackager11.

Answer from SO.
Try to remove jrt-fs.jar from the directory of jdk9. I did it in Project Structure in IntelliJ IDEA and it works fine for me
- Aliaksandr Kot
Mar 24, 2017 at 17:11

Worked for me too... though I'm also unable to load resources from classloader, likely due to missing the FileSystem module jrt.fs. To be fair, I haven't verified yet that the code in question works in any other java 9 environment (it is correct in 8 and lower)
- Ajax
May 3, 2017 at 6:16

Source: https://stackoverflow.com/questions...rnal-jimage-decompressor-in-module-jrt-fs-and
 
Upvote 0

DarkoT

Active Member
Licensed User
Upvote 0
Top