Sub VmArgs As List
Dim jo As JavaObject = Me
Return jo.RunMethod("getVmArgs",Null)
End Sub
#IF JAVA
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
public static java.util.List getVmArgs()
{
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
anywheresoftware.b4a.objects.collections.List res = new anywheresoftware.b4a.objects.collections.List();
res.Initialize();
for(String s : runtimeMxBean.getInputArguments())
{
res.Add(s);
}
return res.getObject();
}
#END IF
Sub VmArgs As List
Dim ManagementFactory As JavaObject
ManagementFactory.InitializeStatic("java.lang.management.ManagementFactory")
Dim runtimeMxBean As JavaObject = ManagementFactory.RunMethod("getRuntimeMXBean", Null)
Return runtimeMxBean.RunMethod("getInputArguments", Null)
End Sub
Just updated to Erel's version - also works beautifully.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by anywheresoftware.b4j.object.JavaObject (file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J/Libraries/JavaObject.jar) to method sun.management.RuntimeImpl.getInputArguments()
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