Jcmd
Sends diagnostic command requests to a running Java Virtual machine (JVM).
Synopsis
Jcmd [-L| - H| -help]
Jcmd pid| Main-class Perfcounter.print
Jcmd pid| Main-class - F filename
Jcmd pid| Main-class Command [ arguments]
Description
The jcmd
utility is used to send diagnostic command requests to the JVM. It must be used on the same in which the JVM is running, and has the same effective user and group identifiers th At were used to launch the JVM.
Note: to invoke diagnostic commands from a remote machine or WI Th different identifiers, you can use The com.sun.management.diagnosticcommandmbean interface. For more information on Thediagnosticcommandmbean interface, see the API documentation Athttp://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/ diagnosticcommandmbean.html |
If you run jcmd
without arguments or -l
with the option, it prints the list of running Java process identifiers with T He main class and command-line arguments that were used to launch the process. Running with the jcmd
-h
or -help
option prints the tool's help message.
Note: the jcmd utility can be used to dynamically interact with Java Flight Recorder (JFR) in a JVM that is already running. You can use it for unlock commercial features, Enable/start/stop flight recordings, and obtain various status messages from The system. For a list of examples, see the Java Flight Recorder Runtime guide at http://docs.oracle.com/javacomp onents/jmc.htm |
If you specify the processes identifier (pid) or the main class (Main-class) as the first argument, sends the diagnostic command request to the Java process with the specified identifier or to all Java processes with the Specified name of the main class. can also send the diagnostic command request to all available Java processes by specifying as the 0
process Identi Fier. Use one of the following as the diagnostic command request:
-
-
Perfcounter.print
-
-
Prints the performance counters available for the specified Java process. The list of performance counters might vary with the Java process.
-
-
-F
filename
-
-
The name of the file from which to read diagnostic commands and send them to the specified Java process. Used with the -f
option. Each command in the file must is written on a. Lines starting with a number sign ( #
) is ignored. Processing of the file ends when all lines has been read or when a line containing the stop
keyword is read.
-
-
Command [
arguments]
-
The command to is sent to the specified Java process. The list of available diagnostic commands for a given process can is obtained by sending the help
command to this process . Each diagnostic command have its own set of arguments. To see the description, syntax, and a list of available arguments for a command, use the name of the command as the Argume NT for the help
command.
Note: If any arguments contain spaces, you must surround them with a single or double quotation marks ( ‘
or "
). In addition, you must escape single or double quotation marks with a backslash ( \
) to prevent the operating system she ll from processing quotation marks. Alternatively, you can surround these arguments with a single quotation marks and then with a double quotation marks (or with Double quotation marks and then with a single quotation marks).
Options
Options are mutually exclusive.
-
-F
filename
-
Reads commands from the specified file. This option can is used only if you specify the process identifier or the main class as the first argument. Each command in the file must is written on a. Lines starting with a number sign ( #
) is ignored. Processing of the file ends when all lines has been read or when a line containing the stop
keyword is read.
-
-H
-
-help
-
Prints a help message.
-
-L
-
Prints the list of running Java processes identifiers with the main class and command-line arguments.
Java Performance Monitoring Tool Jcmd-linux