B4J Question Raspberry PI 4 model B question

rspitzer

Active Member
I decided to test a PI4 model B, and have run into a stumbling block with the B4J bridge.
When I run a program, (in this case one of the tested examples) the bridge give's an error of * failed to add service - already in use?
Locating this error in the forum, basically says the bridge does not work on the PI 4.
In searching the WEB with the same issue, I came across an article that denoted if you comment out the line dtoverlay=vc4-fkms-v3d (last section of the config.txt file), the error is gone from the bridge but nothing runs on the screen of the PI. The log from the bridge does report program started. I am assuming that when remarking the line in config.txt, this does something to the graphics? I don't know.

Anyway,
1: Does anyone have a suggestion???
2: Is the workaround, to use a P3 for writing/running and debugging the code, then run the code as a standalone on the PI4?
 

rspitzer

Active Member
The following is what the bridge shows on the screen when started on the PI:

pi@raspberrypi:~ $ sudo jdk-11.0.1/bin/java -jar b4j-bridge.jar
B4J-Bridge v1.43
Running on Java 11+
External JavaFX not found. Searching for internal modules...
Waiting for connections (port=6790)...
My IP address is: 192.168.2.149
FTP Server started: ftp://192.168.2.149:6781
Start B4J-Bridge with -disableftp to disable.
JavaFX modules: javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.web

The program I am running is one of the examples - ThreePages.b4j
The following is what B4J shows in the log window:

WARNING: Unknown module: javafx.swing specified to --add-opens
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
* failed to add service - already in use?
 
Upvote 0

rspitzer

Active Member
Yup, I read the same post the other day, but decided to post the question to see, if somebody had a workaround. Bellsoft supposedly has a fix for this in their 13.2 JDK, but I have had problems running the bridge using that version of java. When I do run the bridge, it runs, but no java fx modules display on the screen, just says connected and of course when I try to run a B4J program using this, the log basically says it cannot find the additional java fx modules. I am a bit surprised that there are not a lot of complaints about this, which led me to think I was doing something wrong. So the answer is I assume, is be patient and maybe someone will have a workaround for this. The model 4 just seems to be a lot faster than the model 3. Not the end of the world, I can still use a model 3.
 
Upvote 0

rspitzer

Active Member
I maybe getting a bit dogged here, but the PI 4 has been around for about 2 years now. So I asked myself the question, being a newbie, what I might be doing wrong. So in trying to trouble shoot this issue, I have done the following since last night.
I wiped rasperian off the xhdc and reloaded a fresh copy. The difference was the version I was using was the stripped down desktop, this time I loaded the full desk top.
The full desktop comes with java pre installed. I decided not to download any external Java frameworks, thinking part of the problem I had with the previous version was I was basically sullying up the OS.

With the new raspian, for a java version I got:

pi@raspberrypi:~ $ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Raspbian-1deb10u1)


The I decided to see if javafx was also loaded and I got:

pi@raspberrypi:~ $ dpkg-query -L openjfx
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/openjfx
/usr/share/doc/openjfx/TODO.Debian
/usr/share/doc/openjfx/changelog.Debian.gz
/usr/share/doc/openjfx/copyright
/usr/share/openjfx
/usr/share/openjfx/lib
/usr/share/openjfx/lib/javafx.properties
/usr/share/openjfx/lib/javafx.base.jar
/usr/share/openjfx/lib/javafx.controls.jar
/usr/share/openjfx/lib/javafx.fxml.jar
/usr/share/openjfx/lib/javafx.graphics.jar
/usr/share/openjfx/lib/javafx.media.jar
/usr/share/openjfx/lib/javafx.swing.jar
/usr/share/openjfx/lib/javafx.web.jar


So javafx is resident.
I then ran the bridge 2 different ways:

First way:

pi@raspberrypi:~ $ sudo java -jar b4j-bridge.jar
B4J-Bridge v1.43
Running on Java 11+
External JavaFX not found. Searching for internal modules...
Waiting for connections (port=6790)...
My IP address is: 192.168.2.149
FTP Server started: ftp://192.168.2.149:6781
Start B4J-Bridge with -disableftp to disable.
JavaFX modules:
Connected!


As you can see, the bridge ran, but no Javafx modules listed. Of course when I ran a B4J program, I got the add modules error on compilation.

Second way, I added --add modules to the compilation command.

pi@raspberrypi:~ $ sudo java -jar --module-path /usr/share/openjfx/lib --add-modules javafx.graphics b4j-bridge.jar
B4J-Bridge v1.43
Running on Java 11+
External JavaFX not found. Searching for internal modules...
Waiting for connections (port=6790)...
My IP address is: 192.168.2.149
FTP Server started: ftp://192.168.2.149:6781
Start B4J-Bridge with -disableftp to disable.
Connected!
JavaFX modules:


Again no Javafx modules (same no modules error from B4J), I tried the same command line with additional modules, but I got an error -
pi@raspberrypi:~ $ sudo java -jar --module-path /usr/share/openjfx/lib --add-modules javafx.graphics javafx.controls b4j-bridge.jar
Error: Unable to access jarfile javafx.controls


I am thinking 2 thoughts here - I maybe very wrong, so forgive me.

1: There is some type of dependency order on adding multiple modules that I don't understand.
2: When the bridge does run, It always states External JavaFX not found. Searching for internal modules..., so my dumb question is why does it not find the internal modules? Is there a different command invocation?

Just wanted to keep you up to date with what I tried.
 
Upvote 0

rspitzer

Active Member
Thanks for the reply, I myself am in no hurry for this, like I mentioned in an earlier post, I am currently using the model 3, so whenever you get to it, that's fine. Thanks for the effort. Let me know if I can help or test something, gladly will to help in my limited way.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Hopefully you get it figured out, I am in the same boat and looks like the Pi 4 is quickly replacing the 3 as far as resellers are concerned, I had a super difficult time finding a Pi 3, let alone one that was still priced at $35. most have gone way up in price.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The RPi 4 has arrived, however I didn't know that it needs a mini-hdmi connector so can't use it yet.

However I did run Java 13 on RPi 3 and you should try it on RPi 4.

Download: https://download.bell-sw.com/java/13.0.1/bellsoft-jdk13.0.1-linux-arm32-vfp-hflt.tar.gz
Unzip on the pi.

Use B4J-Bridge v1.44: www.b4x.com/b4j/files/b4j-bridge.jar

On the pi 3 I got an error about a missing gtk file. The solution was to add this line to the project:
B4X:
#VirtualMachineArgs: -Djavafx.platform=monocle
 
Upvote 0

rspitzer

Active Member
Had a little time last weekend. I read that raspian just had an upgrade - bg fixes, some feature updates. Downloaded and installed the upgrades. I then went ahead an downloaded per you previous post the bellsoft jdk 13.0.1, and I also download a fresh copy of the bj4 bridge. I had some un expected results from this, the errors have definitely changed.

First running the bridge - I got the following:

pi@raspberrypi:~ $ sudo jdk-13.0.1/bin/java -jar b4j-bridge.jar
B4J-Bridge v1.44
Running on Java 11+
External JavaFX not found. Searching for internal modules...
Waiting for connections (port=6790)...
My IP address is: 192.168.2.149
FTP Server started: ftp://192.168.2.149:6781
Start B4J-Bridge with -disableftp to disable.
JavaFX modules: javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
Connected!


Looking pretty good here, thought something worked out.

Started the Bridge and got:

WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
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
Waiting for debugger to connect...
Program started.


The program I decided to test was the example my first program.

It showed on the screen and seemed to work fine.

I the tested my the program I am currently writing, did have some issues, but I don't think this is related to the model 4 since these errors also occur on the model 3.
I will open a different thread for that if needed.

So all in all, the model 4 seems to be okay, not sure why, Just for your information, the Bridge did not run properly using the installed java 11 that came with the Raspian still, but does work with the downloaded JDK 13.0.1.



 
Upvote 0
Top