B4J Question Resolved: IllegalAccessException

Discussion in 'B4J Questions' started by BeneBarros, Apr 28, 2019.

  1. BeneBarros

    BeneBarros Active Member Licensed User

    I had to format my pc.
    I reinstalled everything again.
    Now on B4J I get this error.

    tballoon._initialize (java line: 459)
    java.lang.IllegalAccessException: class anywheresoftware.b4j.object.JavaObject cannot access class com.sun.glass.ui.Application (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.ui to unnamed module @7564b97b
    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.java:132)
    at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:139)
    at b4j.example.tballoon._initialize(tballoon.java:459)
    at b4j.example.main._appstart(main.java:126)
    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.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:37)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    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)


    error only in release mode.
    in debug mode it works.

    Can someone help me
     
    Last edited: Apr 28, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the code that causes the error (Initialize sub of TBaloon)?
     
  3. BeneBarros

    BeneBarros Active Member Licensed User

    the error occurs when you compile the Reflector or Javaobject.
    I've removed tBaloon now the same error in utils.Init
    Code:
    Public Sub Init
        DApp = GetCanonicalPath (
    File.DirApp)
        
    Private jo As JavaObject
        jo.InitializeStatic (
    "com.sun.glass.ui.Application")
        robot = jo.RunMethodJO (
    "GetApplication"Null) .RunMethodJO ("createRobot"Null)
    End Sub
    Code:
    tBaloon 
    Public Sub Initialize(prt As Pane)
        Showing = 
    False
        Parent = prt
        imIndicator.Initialize(
    "")
        frBalloon.Initialize(
    "frBalloon"180102)
        frBalloon.SetFormStyle(
    "TRANSPARENT")
        frBalloon.BackColor = fx.Colors.transparent
        frBalloon.RootPane.Style = 
    "-fx-background-color: transparent;"
        lbMsg.Initialize(
    "")
        lbMsg.WrapText = 
    True
        lbMsg.Font  = fx.CreateFont(
    "Arial Narrow"14TrueTrue)
        lbMsg.TextColor=fx.Colors.RGB(
    14,16,106
        lbTitle.Initialize(
    "")
        lbTitle.Font  = fx.CreateFont(
    "Arial Narrow"16TrueFalse)
        lbTitle.TextColor=fx.Colors.White   
        base.Initialize(
    "")
        Shdw = 
    "-fx-effect: dropshadow( three-pass-box, rgba(0,0,0,0.6), 5, 0.0, 5, 5);"   
        base.Style = 
    "-fx-background-color: #fdffc7;" & _
                    
    "-fx-border-color: black;" & Shdw
        frBalloon.RootPane.AddNode(base, 
    10101010)
        
    Dim Obj As Reflector
        Obj.Target = frBalloon.RootPane 
        Obj.AddEventHandler2(
    "RPKeyPressed""onKeyPressedProperty")   
        
    Private jo As JavaObject
          jo.InitializeStatic(
    "com.sun.glass.ui.Application")
          robot = jo.RunMethodJO(
    "GetApplication",Null).RunMethodJO("createRobot",Null)                               
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This error is related to a new requirement in Java 11.

    You can add this line to get it running in the IDE in release mode:
    Code:
    #VirtualMachineArgs: --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
    You will need to make a similar change to release_java_modules.txt in B4JPackager11 when you want to build an installer for the app.
     
    Last edited: May 28, 2019
  5. BeneBarros

    BeneBarros Active Member Licensed User

    Unrecognized option: --add
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Are you using Java 11? Are you using B4J-Bridge?
    It did work here.
     
  7. BeneBarros

    BeneBarros Active Member Licensed User

    [QUOTE = "Erel, post: 659524, member: 1"] Você está usando o Java 11? Você está usando o B4J-Bridge?
    Funcionou aqui. [/ QUOTE]


    I am not using the B4J-Bridge
     

    Attached Files:

  8. Erel

    Erel Administrator Staff Member Licensed User

    Beja likes this.
  9. BeneBarros

    BeneBarros Active Member Licensed User

    Last edited: Apr 28, 2019
  10. BeneBarros

    BeneBarros Active Member Licensed User

    I've reinstalled everything without success.

    Is there any way to download the old SDK

    Resolved: I reinstalled the SDK for the second option on the site.
     
    Last edited: Apr 28, 2019
    Beja likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice