B4J Question Liberica - javafx limitation

micro

Well-Known Member
Licensed User
Hi to all
i have same programs that on raspberry with java 8_151 and openjfx-8u60 works fine, i tried Liberica sdk (rwblinn Tutorial) but they crash in same cases.
This is the log after the crash:
B4X:
java.lang.reflect.InaccessibleObjectException: Unable to make public com.sun.glass.ui.Robot com.sun.glass.ui.monocle.MonocleApplication.createRobot() accessible: module javafx.graphics does not "exports com.sun.glass.ui.monocle" to unnamed module @4f9254
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:130)
    at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:138)
    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:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    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:3876)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Scene.java:3604)
    at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
    at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2613)
    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:389)
    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:844)
How can I fix this inconvenience?
Thanks

Edit:
This the code which crashes
B4X:
Dim robot As JavaObject
    Dim jo As JavaObject
    jo.InitializeStatic("com.sun.glass.ui.Application")
    robot = jo.RunMethodJO("GetApplication",Null).RunMethodJO("createRobot",Null)
    Dim lb As Label
    lb = Sender
    Select lb.Tag
        Case "Enter"
            robot.RunMethod("keyPress", Array As Object(10))
..................
 
Last edited:

Daestrum

Well-Known Member
Licensed User
It looks like Liberica SDK is java 10 based and uses modules.
This would explain the message end 'does not "exports com.sun.glass.ui.monocle" to unnamed module'.

Unfortunately, java 10 requires explicit exports from a module. (if I recall correctly, any com.sun… class file referenced from a module becomes private).
 
Upvote 0
Top