Wish Help needed running jar with JRE 19+

Num3

Active Member
Licensed User
Longtime User
Hi all,

Since the last java 8 update, JavaFX was ditched, so I naturally went on the quest for another JRE to install and run the applications on windows.

I have searched the forums, but have not found any post with relevant information on how to do this.

I have installed Azul ZuluFX 21 JRE (using winget install Azul.ZuluFX.21.JRE), that includes the javafx inside the bin directory, but i am unable to run my programs, there are lot's of errors when running the compiled program by double clicking or shell (i.e. Statusbar from jControlsFX, B4XCanvas, etc...), all saying "because module javafx.xxxx does not export com.sun.javafx.xxx"

Example:
pmain._show (java line: 1747)
java.lang.RuntimeException: java.lang.IllegalAccessError: class anywheresoftware.b4a.objects.B4XCanvas$B4XPath (in unnamed module @0x1d5e21e6) cannot access class com.sun.javafx.geom.Path2D (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.geom to unnamed module @0x1d5e21e6
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4j.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:85)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:109)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
at anywheresoftware.b4j.objects.ScrollPaneWrapper.LoadLayout(ScrollPaneWrapper.java:99)
at gel.central.pmain._show(pmain.java:1747)
at gel.central.plogin$ResumableSub_login_entrar_Click.resume(plogin.java:161)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:156)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1172)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalAccessError: class anywheresoftware.b4a.objects.B4XCanvas$B4XPath (in unnamed module @0x1d5e21e6) cannot access class com.sun.javafx.geom.Path2D (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.geom to unnamed module @0x1d5e21e6
at anywheresoftware.b4a.objects.B4XCanvas$B4XPath.InitializeArc(B4XCanvas.java:370)
at gel.central.elevadores.circularprogressbar._drawvalue(circularprogressbar.java:249)
at gel.central.elevadores.circularprogressbar._designercreateview(circularprogressbar.java:226)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 17 more

It only runs when using java 8 JRE, or when running from the IDE.

And I have tried this also:

'#JavaCompilerPath: 8,D:\Programming\jdk-8u311\bin\javac.exe
#JavaCompilerPath: 19,D:\Programming\jdk-19.0.2\bin\javac.exe

Can someone point me in the right direction, on how to correctly install a different JRE with all needed dependencies?
 
Last edited:

Num3

Active Member
Licensed User
Longtime User
Follow the instructions on the B4j Installation page, https://www.b4x.com/b4j.html. That will get you running.

The instructions are only for installing and running B4J and the included JDK is not a JRE.

The problem is with client machines, where a Runtime Environment is needed to run the code. Before Java8 JRE worked fine (it included JFX) and it was a one click install, but not anymore, so it is a dead horse, forever stuck in the same version.

The logical move is to move forward and use a third party, free, more up-to-date JRE.

I installed many options and all have the same problem, the application crashes sooner or later, due to the error of "javafx.xxxx not exporting com.sun.javafx.xxxxx"

Since no one else seems to have this problem, I reach for help, because I have not found any instructions or tutorial on how to install a JRE that works with a B4J compiled jar.

Sure i can use the standalone packager and distribute the app, but I would like to keep the possibility of running it on a JRE.
 
Last edited:

Daestrum

Expert
Licensed User
Longtime User
You could just use the standalone packager - then they would get the app with the runtime without needing to install java at all.
 

stevel05

Expert
Licensed User
Longtime User
While it is possible to create a batch file to run a java 9+ jar, it still needs the the jdk for the javafx-jmods and wouldn't be a sensible way to distribute apps. I haven't tried, and don't think it would be a good idea to try using the Javafx JDK with a java JRE (but I'm not an expert, perhaps it's feasible). As Daestrum says the way to go is to package the app, the user doesn't then have to worry about installing anything for java.

It is unlikely that anyone here has tried it. You will probably have to look further afield for help with this I think.
 
Top