jconsole just provides a wrapper around the JMX MBeans that are in the platform MBeanServer.
You can write a program to connect to your VM using the Attach API which would then query the MBeans.
Or you can expose the platform MBeanServer over RMI and query the MBeans that way.
See the java.lang.management package for more info