Bug? B4J-Bridge problem with executing files on remote Windows machine (Java 11)


Well-Known Member
Licensed User

B4J Bridge doesn't run jars anymore on Windows with Java 11. With java 8, no problems, but I now encounter this problem when executing my jar on another Windows Machine:
Error: JavaFX runtime components are missing, and are required to run this application
The other machine has the bundle JavaFX + OpenJDK installed, and set in the PATH correctly. The problem is that JavaFX is not loaded properly.

After testing a bit, I came up with a solution, which is to modify this function in B4j-Bridge source code:
Sub Streams_NewStream (Dir As String, FileName As String)
    If shl.IsInitialized Then shl.KillProcess
    'new file has arrived
    Log("Starting program")
    Dim jo As JavaObject
    jo.InitializeNewInstance("java.io.File", Array As String(File.Combine(Dir, FileName)))
    jo.RunMethod("setExecutable", Array As Object(True, False))
    Dim args As List
    '<<<<<The following block is what I've edited:
    Dim JavaVersion As String = GetSystemProperty("java.version","0.0")
    If JavaVersion.StartsWith("1.8") Then
        args.AddAll(Array As String("-jar", FileName))
        args.AddAll(Array As String("--module-path", File.Combine(GetSystemProperty("java.home", ""), "javafx\lib"), "--add-modules", "javafx.controls,javafx.fxml", "-jar", FileName))
    End If
    If currentArguments <> Null Then args.AddAll(currentArguments)
    currentArguments = Null
    shl.Initialize("shl", javaExe, args)
    shl.WorkingDirectory = jarsFolder
End Sub
It works for me, but maybe needs more polishing?

In any case, this B4j-bridge is a great tool, thank you!

edit: changed the title


Well-Known Member
Licensed User
B4J-bridge.jar executes properly, but the problem is the jar that is executed by B4j-bridge.

I'm not sure my scenario is clear. I'll explain better:
1) I have my computer (COMP1), with B4J
2) I have another computer (COMP2), running B4j-bridge (java -jar b4j-bridge.jar)
3) COMP2 has all the Javafx and Openjfx installed properly
4) On COMP1, I connect to COMP2 with b4jbridge, it works
5) I run my app in Release or Debug
6) I have this red line showing up in the application log:
Error: JavaFX runtime components are missing, and are required to run this application


Well-Known Member
Licensed User
For example maybe 'java' starts the wrong version of java.
Ok, I see what you mean. I'm at home, and it works here, this is the log from b4j-bridge:
B4J-Bridge v1.43
Running on Java 11+
JavaFX modules: javafx.swt,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
External JavaFX path: C:\Program Files\Java\jdk-11.0.1\jdk-11.0.1\javafx\lib
Waiting for connections (port=6790)...
My IP address is:
FTP Server started:
Start B4J-Bridge with -disableftp to disable.
We can see that the javafx libraries are loaded. I will report tomorrow on the difference with my setup at the office. Thank you.


Well-Known Member
Licensed User
I found the problem, there was a PATH environment variable which was pointing to:
Deleting this variable solved the problem.