jdk.jcmd/sun.tools.jcmd.JCmd - "jcmd" Command


How to run "jcmd" command from JDK lib\modules JImage file?

✍: FYIcenter


"jcmd" command allows you to list all running JVM processes on your computer system and interact with them.

"jcmd" command is supported by the jmods\jdk.jcmd.jmod module file, which is also linked into the lib\modules JImage file in JDK 9, 10, and 11.

You can run the "jcmd" command using the lib\modules JImage file as described below using JDK 11 as an example:

C:\fyicenter>set JDK_HOME=\fyicenter\jdk-11.0.1

C:\fyicenter>%JDK_HOME%\bin\java --module jdk.jcmd/sun.tools.jcmd.JCmd -h

Usage: jcmd <pid | main class> <command ...|PerfCounter.print|-f file>
   or: jcmd -l
   or: jcmd -h

  command must be a valid jcmd command for the selected jvm.
  Use the command "help" to see which commands are available.
  If the pid is 0, commands will be sent to all Java processes.
  The main class argument will be used to match (either partially
  or fully) the class used to start Java.
  If no options are given, lists Java processes (same as -l).

  PerfCounter.print display the counters exposed by this process
  -f  read and execute commands from the file
  -l  list JVM processes on the local machine
  -h  this help


⇒ jdk.jcmd/sun.tools.jinfo.JInfo - "jinfo" Command

⇐ jdk.javadoc/jdk.javadoc.internal.tool.Main - "javadoc" Command

⇑ Tools Supported from JDK 9+ lib\modules JImage

⇑⇑ FAQ for JDK (Java Development Kit)

2020-02-07, 1050👍, 0💬