as described on this page you can access it remotly, with the MBeanServerConnection
:
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
// that has the JVM MXBeans registered in it
...
try {
// Assuming the RuntimeMXBean has been registered in mbs
ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
// Get standard attribute "VmVendor"
String vendor = (String) mbs.getAttribute(oname, "VmVendor");
} catch (....) {
// Catch the exceptions thrown by ObjectName constructor
// and MBeanServer.getAttribute method
...
}
however, as far as I understand, you won't be able to use the Java interface, you'll need to query the properties you want with
CompositeDataSupport mem = (CompositeDataSupport)serv.getAttribute(memory, "NonHeapMemoryUsage") ;
and
mem.get("committed")
which is quite awfull ('stringly-typed' interface, as they said in another question).
As Brian Agnew said, the JConsole view is very usefull to find out where the information you want is stored.