I reproduced the problem I have in a minimal project. Create a new default B4XPage app, and change Button1_Click as follows:
Private Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X " & TryThisInstead)
End Sub
Sub TryThisInstead As String
Dim jo As JavaObject
Log("initializing MF")
jo=jo.InitializeStatic("java.lang.management.ManagementFactory")
Return ""
End Sub
This is a stripped down test. In my (larger) application, and when creating this minimal app, it is the first step, followed by getRuntimeMXBean, then getName, to get the PID.
This is failing after Build Standalone Package trying to run the .exe (in this example, upon clicking the button), but works when run from the IDE.
I've been using jdk 14 and also tried 11, same issue.
I'm guessing there is perhaps a dll or additional jar to include, but haven't discovered that yet. Has someone run across this and has the solution?
run_debug.bat shows the error while running the built .exe.
initializing MF
b4xmainpage._trythisinstead (java line: -1)
java.lang.ClassNotFoundException: java$lang$management$ManagementFactory
at b4j/anywheresoftware.b4j.object.JavaObject.getCorrectClassName(Unknown Source)
at b4j/anywheresoftware.b4j.object.JavaObject.InitializeStatic(Unknown Source)
at b4j/b4j.example.b4xmainpage._trythisinstead(Unknown Source)