B4J Question Raspberry 5 and Java FX

Peter Lewis

Well-Known Member
Licensed User
Longtime User
I just purchased a Raspberry 5 which I want to run some graphics on.

As per recommendation by @Erel I downloaded the suggested JDK

Download and unpack the Linux ARM Full JDK (21): https://download.bell-sw.com/java/21.0.6+10/bellsoft-jdk21.0.6+10-linux-aarch64-full.tar.gz and uncompressed it.

I then installed OpenFX


Pi5 .jpeg


I installed the bridge and rand a simple example program which worked perfectly.

I then tried to run the graphic app which also played videos and it failed. I did not expect it to run due to the video files.

If I compile the program on the Windows PC , it does not run. Only if I run it through B4J in debug mode

Libraries used are JFX,jMediaView, jXUI

If I run the Debug from the Build folder after making a standalone package, I get this error


My question is should I install version 11 of JDK on the Pi 5

If the compile does not work on Windows, .jar file, How do I generate the file that will work on the Pi without going through the build stand alone package.

What would the command line look like for the Pi ?

B4X:
jdk-21.0.6-full/bin/java -jar peter.jar



Basic code excluding the transition code:
#Region Project Attributes
    #MainFormWidth: 280
    #MainFormHeight: 880
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI 
    Public mainpnl,panel2 As B4XView
    Private xui As XUI
    Private MediaView1 As MediaView
    Private MediaView2 As MediaView
    Private Label1 As Label
    Private Label2 As Label
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.SetFormStyle("UNDECORATED")
    MainForm.WindowLeft=0
    MainForm.WindowTop=0
    MainForm.Show
    MediaView2.Source=  File.geturi(File.DirAssets,"design.mp4")
    MediaView1.Source=  File.geturi(File.DirAssets,"forestn.mp4")
    
    dostart
    
    
End Sub

Sub dostart
    
    Dim x As Int =0

    Do Until x=1
        loadpageinadvance(mainpnl)
        MediaView1.Position=0
        MediaView1.Play
        clickpanel2(1)
        showPanelandHideSender(panel2,mainpnl)
        
        Dim first As Int =10000
            Do Until first = 0
                Sleep(1000)
                first = first - 1000
                Label1.Text="1 "&(first/1000)
                Sleep(0)
            Loop
                loadpageinadvance(panel2)
                MediaView2.Position=0
                MediaView2.Play
                clickpanel1(1)
                showPanelandHideSender(mainpnl,panel2)

        Dim second As Int =10000
            Do Until second = 0
                Sleep(1000)
                second = second - 1000
                Label2.Text= "2 "&(second/1000)
                Sleep(0)
            Loop
    Loop
End Sub
 

aminoacid

Active Member
Licensed User
Longtime User
Go through this entire thread, you should find the solution there:

 
Upvote 0

Peter Lewis

Well-Known Member
Licensed User
Longtime User
The error message is related to a failed attempt to play an asset file. Try to copy it to XUI.DefaultFolder and then play it from there.
Thank you for the windows solution. What would the folder be in Raspberry Pi ? If I develop on Windows .

Thank you
 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
If you have some different in the code for the PI just check your OS.

Myself I have some PI's running here and all running on JDK 11
Like
sudo apt install openjdk-11-jre-headless
FX
sudo apt-get install openjfx
 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
If you connect to the PI and use Debug? the execution can be very slow. Lets say I see this here.
Release mode is no issue.
 
Upvote 0

Peter Lewis

Well-Known Member
Licensed User
Longtime User
If you have some different in the code for the PI just check your OS.

Myself I have some PI's running here and all running on JDK 11
Like
sudo apt install openjdk-11-jre-headless
FX
sudo apt-get install openjfx
The code is the same as Windows.

How do I specify a folder for the Video files for Raspberry and Windows ? the Default XUI folder specifically as Raspberry does not have c:\????

Thank you
If you have some different in the code for the PI just check your OS.

Myself I have some PI's running here and all running on JDK 11
Like
sudo apt install openjdk-11-jre-headless
FX
sudo apt-get install openjfx
I tried your command line but I think that it is now obsolete, any other options ?
Thank you

 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
The code is the same as Windows.

How do I specify a folder for the Video files for Raspberry and Windows ? the Default XUI folder specifically as Raspberry does not have c:\????

Thank you

I tried your command line but I think that it is now obsolete, any other options ?
Thank you
Will check
 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
Maybe try this
Read all on that site
Your Pi is 64 bit I assume.
 
Upvote 0

Peter Lewis

Well-Known Member
Licensed User
Longtime User
Maybe try this
Read all on that site
Your Pi is 64 bit I assume.
yes it is and I have the Pi5 with 8GB RAM booting with a M.2 NVME
 
Upvote 0
Top