Search code examples
javadebuggingvirtual-machinejconsole

How do I get the VM information presented in JConsole?


Starting JConsole, selecing a process and then and heading over to VM Summary, one can see a lot of VM information, such as:

  • Number of live threads
  • Number of current classes loaded
  • Compilation time
  • Current heap size
  • Total threads started

Is there I can access that information inside a Java application? If so, how?

Update: Here is an image http://download.oracle.com/javase/1.5.0/docs/guide/management/images/summarytab.jpg


Solution

  • The name of the beast is "Java Management Extension (JMX)".

    Here is a "Getting Started" overview from oracle. You'll have to implement a JMX Manager to read the published internals from the JVM or from other instrumented applications.