Overview
jconsole is the JDK's graphical JMX client: connect to a JVM and get live charts of heap,
threads, classes and CPU, plus a browser for every registered MBean — the JVM's platform MBeans
(Memory, Threading, GarbageCollector, OperatingSystem) and whatever the application exposes
(connection pools, caches, Tomcat, Kafka clients). It is old and plain, but it is the quick
way to read or poke an MBean attribute without writing code.
Key points
- Attach: local JVMs are listed by pid (same-user attach); remote needs the target started
with
-Dcom.sun.management.jmxremote.port=9010(+ SSL/auth settings — never disable both on a reachable interface; the JMX RMI port is a remote-code-execution surface if open). - MBeans tab: the real feature — read attributes live, write writable ones, and invoke
operations (e.g.
HotSpotDiagnostic.dumpHeap, a pool'ssoftEvictConnections). - Platform MBeans:
java.lang:type=Memory(heap usage +gc()button),type=Threading(findDeadlockedThreads, per-thread CPU),type=GarbageCollector,*(collection counts/times) — the same data jstat/jcmd print, behind a stable API. - Frameworks feed it: Spring Boot (via Actuator/
spring.jmx.enabled), Quarkus and Micronaut can register their metrics and management endpoints as MBeans, making jconsole a zero-dependency inspection tool for them. - jconsole vs Mission Control vs VisualVM: jconsole = live JMX values and MBean surgery; JMC = deep offline analysis of JFR recordings (method profiling, allocation, latency events) plus its own MBean browser; VisualVM (now standalone, not in the JDK) = middle ground — sampler/profiler, heap-dump browsing, plugins. Rule of thumb: poke an MBean → jconsole; understand performance → JFR + JMC; quick sampling profile with a GUI → VisualVM.
- Overhead: polling JMX is cheap but not free; charts sample at intervals and can miss spikes JFR would catch.
Examples
jconsole 4242 # local attach by pid
jconsole svc-host:9010 # remote JMX (configured & secured)
Related
- JDK & tools — parent catalogue of the JDK toolchain.
- JFR & Mission Control — the deep-analysis sibling; JMC also browses MBeans.
- jcmd — CLI access to much of the same platform data.
- jstat — terminal-only view of the memory/GC counters jconsole charts.
- Performance engineering — choosing the right observation tool per question.