B4J Question B4J Libraries and Java 11+ Compatibillity with previous projects

ThRuST

Well-Known Member
Licensed User
Longtime User
I have installed the latest (at the time posting) B4J v7 and Java 11.

I want to make my huge project Athena compatible with this latest Java version.
That's why I ask the neccessary libraries to be updated to work with the latest Java version.

This is the error I get when I run my project Athena

B4JError.JPG


Libraries used

B4JLibs.JPG


It used to work with SDK v9.0.4 but as you all understand I have to keep up to date with the latest updates of Java, so I am asking for updates of the included libraries for whom it may concern.

Thanks
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Thanks. I can either send you the source code of Athena, or hope that you can improve any of the versions of B4Jpackager so java v9.0.4 can be bundled in the package.

I wil try to find the error myself in my project. It's related when starting the documents manager. The rest works with open java11.0.1
(I followed your instructions how to install it from the b4j page).
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Here's the log from Athena when running on open java-11.0.1 (as installed from b4j page). It crashes on the documents manager
I am sure you understand the error log much better than I do.

main._btnmenudocuments_click (java line: 3801)
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
at anywheresoftware.b4j.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:68)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:93)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:84)
at anywheresoftware.b4j.objects.TabPaneWrapper.LoadLayout(TabPaneWrapper.java:94)
at athena.duologic.se.main._btnmenudocuments_click(main.java:3801)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA$1.run(BA.java:216)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ExceptionInInitializerError
at org.fxmisc.richtext.ParagraphBox.<init>(ParagraphBox.java:88)
at org.fxmisc.richtext.GenericStyledArea.createCell(GenericStyledArea.java:1304)
at org.fxmisc.richtext.GenericStyledArea.lambda$new$9(GenericStyledArea.java:676)
at org.fxmisc.flowless.CellPool.getCell(CellPool.java:28)
at org.fxmisc.flowless.CellListManager.cellForItem(CellListManager.java:86)
at org.reactfx.collection.MappedList.get(MappedList.java:27)
at org.reactfx.collection.MemoizationListImpl.get(MemoizationList.java:99)
at org.fxmisc.flowless.CellListManager.getCell(CellListManager.java:69)
at org.fxmisc.flowless.CellPositioner.getSizedCell(CellPositioner.java:217)
at org.fxmisc.flowless.CellPositioner.placeStartAt(CellPositioner.java:127)
at org.fxmisc.flowless.Navigator.placeStartAtMayCrop(Navigator.java:201)
at org.fxmisc.flowless.Navigator.visit(Navigator.java:129)
at org.fxmisc.flowless.StartOffStart.accept(TargetPosition.java:85)
at org.fxmisc.flowless.Navigator.layoutChildren(Navigator.java:78)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1204)
at org.fxmisc.flowless.VirtualFlow.layoutChildren(VirtualFlow.java:257)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1204)
at org.fxmisc.flowless.VirtualFlow.visibleCells(VirtualFlow.java:230)
at org.fxmisc.richtext.GenericStyledArea.<init>(GenericStyledArea.java:712)
at org.fxmisc.richtext.StyledTextArea.<init>(StyledTextArea.java:33)
at org.fxmisc.richtext.StyledTextArea.<init>(StyledTextArea.java:45)
at org.fxmisc.richtext.StyleClassedTextArea.<init>(StyleClassedTextArea.java:18)
at org.fxmisc.richtext.StyleClassedTextArea.<init>(StyleClassedTextArea.java:31)
at org.fxmisc.richtext.CodeArea.<init>(CodeArea.java:36)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:86)
at athena.duologic.se.codearea._designercreateview(codearea.java:414)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
... 18 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make com.sun.javafx.scene.text.TextLayout javafx.scene.text.TextFlow.getTextLayout() accessible: module javafx.graphics does not "opens javafx.scene.text" to unnamed module @56d8a66e
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
at org.fxmisc.richtext.TextFlowExt.<clinit>(TextFlowExt.java:34)
... 54 more
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Btw I use this in the beginning of Main

B4X:
#AdditionalJar: sqlite-jdbc-3.7.2
#AdditionalJar:  richtextfx-fat-0.8.2
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The RichtextFX Library doesn't appear to support Java 11 yet, I would suggest that you use JDK 8 for now which seems to still be available.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
@stevel05 I prefer to stay with JDK 9.0.4 to continue my work, but the problem is just how to make it run on systems that have the new Java installed.
Daestrum suggested a runnable Batch file, so I hope that will solve it as the previous version of B4JPackager supports Java 8 but not 9.
I don't mind to make it run from a batch file, even though it would be nice to create an installation with B4JPackager when it's ready for distribution.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Btw it seems reasonable that RichTextFX will be compatable with Java 11, so I guess I can keep using JDK 9.0.4 and wait for them to update RichTextFX one day.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Hello World :)

It is possible to make Java 8/9 projects compatible with open JDK-11.0.1+ by using command line parameters

Cmd
B4X:
java --module-path C:\java\jdk-11.0.2\lib --add-modules=javafx.controls -jar NameOfYourApp.jar

Credits to Daestrum the Wizard for saving the world.
 
Upvote 0
Top