The information obtained by JConsole is obtained via the JMX API -- basically, java 5 JVM includes a built-in mbean server. This means any external program can obtain an mbean server connection to get the same information.
The internal application (code running in the JVM) can obtain the mxbeans directly via the ManagementFactory class -- which is much easier than using an mbean server connector.
See
this tutorial for more information.
Henry