B4J Question B4j IDE crashes after clicking on List variables when using JAVA version OpenJDK 19

johnerikson

Active Member
Licensed User
Longtime User
Declared variables of type List cannot be read by pointing to it. B4j stops immediately
without notifications.
I'm using Windows 11 and B4j 10.30

Note that there is no problem with compiling and running the program if you avoid clicking on variables of type List.
OpenJDK 14, on the other hand, works satisfactorily in this regard
 
Solution
I'm unable to reproduce it with a simple list:

View attachment 165637
If you are able to reproduce it in a small project then please upload it.
The issue is only happened in Non-UI project. @Erel
This is caused Illegal reflective access by JDebug.jar to field java.util.ArrayList.elementData.
The illegal access operations has been denied in jdk17+
It can be solved by adding JVM args.
B4X:
#VirtualMachineArgs:--add-opens java.base/java.util=ALL-UNNAMED

Swissmade

Well-Known Member
Licensed User
Longtime User
Sounds something like this I have seen
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
No not IDE tself, the stop does not generate an error message, but just jumps out of debugging mode!
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm unable to reproduce it with a simple list:

1753766668264.png

If you are able to reproduce it in a small project then please upload it.
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
After testing small projects, it turns out that the problem occurs only in non IO projects (server-proj).

Sending a small non io project, where I added a list variable and a breakpoint on StartMessageLoop.
After start - running, when pointing to the variable lMsgOK, the debugger appears!
 

Attachments

  • ExFileServer.zip
    81.2 KB · Views: 38
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Try this version.
You were still using the HTTP modules that are deprecated by long time.
I removed the modules and added the library
jOKHttpUtils2
that is included with B4J.
Let us know if now it works.
 

Attachments

  • FileServer.zip
    2.3 KB · Views: 37
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
It should be visible.
It's an internal library.
In the projects it's already flagged so you should see it in the upper part.
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
A miserable miss, after checking it turns out that jOKHttpUtils2 is there in the list!
Unfortunately, after testing your version, the Debugger kept crashing when pointing to the List variable!
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
I can't test it deeply because it looks that it needs some kind of token for DuckDns
 
Upvote 0

johnerikson

Active Member
Licensed User
Longtime User
You can run your own version by annotating Duckdn's subs and adding a breakpoint to line 29

B4X:
'Non-UI application (console application)
#Region  Project Attributes
    #CommandLineArgs:
    #MergeLibraries: False
#End Region

Sub Process_Globals
    'Private domain As String = "xxx"
    'Private token As String = "yyy"
    Private updateIp As Timer
    Private srvr As Server
    Public filesFolder As String = "uploaded"
    Dim lMsgOk As List
End Sub

Sub AppStart (Args() As String)
    updateIp.Initialize("updateIp", 10 * 60 * 1000) '10 minutes
    updateIp.Enabled = True
    'UpdateIp_Tick
    srvr.Initialize("srvr")
    srvr.Port = 54021
    File.MakeDir(File.DirApp, filesFolder)
    srvr.AddHandler("/upload", "Upload", False)
    srvr.AddHandler("/test", "Test", False)
    srvr.Start
    Log("Server started")
    lMsgOk.Initialize
    lMsgOk.Add("Test")
    StartMessageLoop
End Sub

'Sub UpdateIp_Tick
'    Dim j As HttpJob
'    j.Initialize("j", Me)
'    j.Download2("http://www.duckdns.org/update", Array As String("domains", domain, "token", token, _
'        "ip", ""))
'End Sub
'
'Sub JobDone (j As HttpJob)
'    If j.Success = True Then
'        Log("Update DuckDNS: " & j.GetString)
'    Else
'        Log("Error updating Duck DNS: " & j.ErrorMessage)
'    End If
'    j.Release
'End Sub
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Oh Yes, now I got it.
Yes I can confirm the BUG or the strange behaviour of Java 19.
After the program stopped at breakpoint, with Java 14 you can hover variables to see values with no problems.
With Java 19 when hovering a variable you can see the value just for a couple of seconds and then the debug windows will close.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I'm unable to reproduce it with a simple list:

View attachment 165637
If you are able to reproduce it in a small project then please upload it.
The issue is only happened in Non-UI project. @Erel
This is caused Illegal reflective access by JDebug.jar to field java.util.ArrayList.elementData.
The illegal access operations has been denied in jdk17+
It can be solved by adding JVM args.
B4X:
#VirtualMachineArgs:--add-opens java.base/java.util=ALL-UNNAMED
 
Last edited:
Upvote 0
Solution
Top