B4J Question Same problems on Raspberry with openjdk11

micro

Well-Known Member
Licensed User
Hi to all
Now everything seems to work with openjdk11.01, but there are some problems I didn't have with java8 before.
in my project I use a keyboard where the buttons are labels and I use the robot function to handle the key pressed and release event
B4X:
Dim jo As JavaObject
jo.InitializeStatic("com.sun.glass.ui.Application")
robot = jo.RunMethodJO("GetApplication",Null).RunMethodJO("createRobot",Null)
When touch the label this error appears:
B4X:
java.lang.RuntimeException: java.lang.IllegalAccessException: class anywheresoftware.b4j.object.JavaObject cannot access class com.sun.glass.ui.monocle.MonocleApplication (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui.monocle to unnamed module @1621186
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at anywheresoftware.b4j.objects.NodeWrapper$3.handle(NodeWrapper.java:115)
    at anywheresoftware.b4j.objects.NodeWrapper$3.handle(NodeWrapper.java:1)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.
javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
    at javafx.graphics/javafx.scene.Scene.process
MouseEvent(Scene.java:1849)
    at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
    at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
    at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
    at javafx.graphics/com.sun.glass.ui.monocle.MonocleView.notifyMouse(MonocleView.java:116)
    at javafx.graphics/com.sun.glass.ui.monocle.MouseInput.notifyMouse(MouseInput.java:314)
    at javafx.graphics/com.sun.glass.ui.monocle.MouseInput.lambda$postMouseEvent$3(MouseInput.java:227)
    at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
    at javafx.graphics/com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalAccessException: class anywheresoftware.b4j.object.JavaObject cannot access class com.sun.glass.ui.monocle.MonocleApplication (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui.monocle to unnamed module @1621186
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
    at java.base/java.lang.reflect.Method.invoke(Method.java:558)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.j
ava:132)
    at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:139)
    at b4j.softkey.softkeyboardraspy$ResumableSub_lbtouch_MouseReleased.resume(softkeyboardraspy.java:220)
    at b4j.softkey.softkeyboardraspy._lbtouch_mousereleased(softkeyboardraspy.java:186)
    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)
    ... 34 more
how can i solve?
Thanks
 

micro

Well-Known Member
Licensed User
Thanks to all but the error is the same
Added:
B4X:
#VirtualMachineArgs: --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
Java was downloaded from https://www.b4x.com/b4j.html
This is the error:
B4X:
Unrecognized option: --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
 

micro

Well-Known Member
Licensed User
In release mode the program run correctly but if i touck on the label the program crashes
this is the error
B4X:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by anywheresoftware.b4j.object.JavaObject (file:/home/pi/Test/Test.jar) to method com.sun.glass.ui.Application.GetApp                   lication()
WARNING: Please consider reporting this to the maintainers of anywheresoftware.b4j.object.JavaObject
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
 
Top