rgoussu@goussu: ~/library/java/jdk-and-tools
~/library/java/jdk-and-tools cat jps.md

jps — listing JVM processes

# Lists running JVMs with pids, main classes and arguments, backed by the JVM's shared-memory perfdata files.

Conceptsaved 2026-08-09 #java#jvm#tooling#diagnostics

Overview

jps is ps for JVMs: it lists the Java processes visible to the current user with their pids and main class, and is usually the first command in any JVM diagnostic session — you need a pid before jcmd, jstack or jstat can do anything. Bare jcmd now does the same listing, but jps flags give more control over what is shown.

Key points

  • Default output: pid + short main class name (or jar name for java -jar launches).
  • -l: full package name of the main class, or full path to the jar.
  • -m: arguments passed to main().
  • -v: JVM arguments (-Xmx, -D... flags) — quick way to check what heap a process was really given.
  • -q: pids only, handy for scripting.
  • Perfdata mechanism: each HotSpot JVM exports instrumentation counters into a memory-mapped file /tmp/hsperfdata_<user>/<pid> (unless -XX:-UsePerfData). jps discovers JVMs by scanning these files and reads its data from them — no attach needed.
  • Consequences: you only see JVMs of users whose perfdata dirs you can read (in practice: your own, or all as root); wiping /tmp or setting -XX:PerfDisableSharedMem makes processes invisible to jps/jstat; containers isolate /tmp, so jps inside the container or nsenter is needed for containerised JVMs.
  • Remote mode is dead: the old jps <host> via jstatd is effectively obsolete; use proper observability for remote hosts.

Examples

jps -lv
# 4242 com.example.app.Main -Xmx2g -Dspring.profiles.active=prod
# 5150 org.gradle.launcher.daemon.bootstrap.GradleDaemon -Xmx1g

Related

  • JDK & tools — parent catalogue of the JDK toolchain.
  • jcmd — bare jcmd lists JVMs too, then takes the pid you found.
  • jstat — reads the same perfdata counters, continuously.
  • jstack — typical next step once you have the pid.