1jcmd(1) Troubleshooting Tools jcmd(1)
2
3
4
6 jcmd - Sends diagnostic command requests to a running Java Virtual
7 Machine (JVM).
8
10 jcmd [-l|-h|-help]
11
12 jcmd pid|main-class PerfCounter.print
13
14 jcmd pid|main-class -f filename
15
16 jcmd pid|main-class command[ arguments]
17
19 The jcmd utility is used to send diagnostic command requests to the
20 JVM. It must be used on the same machine on which the JVM is running,
21 and have the same effective user and group identifiers that were used
22 to launch the JVM.
23
24 Note
25 ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
26 │ │
27 │ To invoke diagnostic │
28 │ commands from a remote │
29 │ machine or with different │
30 │ identifiers, you can use the │
31 │ com.sun.management.DiagnosticCommandMBean │
32 │ interface. For more │
33 │ information about the │
34 │ DiagnosticCommandMBean │
35 │ interface, see the API │
36 │ documentation at │
37 │ http://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/DiagnosticCommandMBean.html │
38 └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
39
40 If you run jcmd without arguments or with the -l option, it prints the
41 list of running Java process identifiers with the main class and
42 command-line arguments that were used to launch the process. Running
43 jcmd with the -h or -help option prints the tool’s help message.
44
45 If you specify the processes identifier (pid) or the main class
46 (main-class) as the first argument, jcmd sends the diagnostic command
47 request to the Java process with the specified identifier or to all
48 Java processes with the specified name of the main class. You can also
49 send the diagnostic command request to all available Java processes by
50 specifying 0 as the process identifier. Use one of the following as the
51 diagnostic command request:
52
53 Perfcounter.print
54 Prints the performance counters available for the specified Java
55 process. The list of performance counters might vary with the Java
56 process.
57
58 -f filename
59 The name of the file from which to read diagnostic commands and
60 send them to the specified Java process. Used only with the -f
61 option. Each command in the file must be written on a single line.
62 Lines starting with a number sign (#) are ignored. Processing of
63 the file ends when all lines have been read or when a line
64 containing the stop keyword is read.
65
66 command [arguments]
67 The command to be sent to the specified Java process. The list of
68 available diagnostic commands for a given process can be obtained
69 by sending the help command to this process. Each diagnostic
70 command has its own set of arguments. To see the description,
71 syntax, and a list of available arguments for a command, use the
72 name of the command as the argument for the help command.
73
74 Note: If any arguments contain spaces, you must surround them with
75 single or double quotation marks (' or "). In addition, you must
76 escape single or double quotation marks with a backslash (\) to
77 prevent the operating system shell from processing quotation marks.
78 Alternatively, you can surround these arguments with single
79 quotation marks and then with double quotation marks (or with
80 double quotation marks and then with single quotation marks).
81
83 Options are mutually exclusive.
84
85 -f filename
86 Reads commands from the specified file. This option can be used
87 only if you specify the process identifier or the main class as the
88 first argument. Each command in the file must be written on a
89 single line. Lines starting with a number sign (#) are ignored.
90 Processing of the file ends when all lines have been read or when a
91 line containing the stop keyword is read.
92
93 -h
94 -help
95 Prints a help message.
96
97 -l
98 Prints the list of running Java processes identifiers with the main
99 class and command-line arguments.
100
102 · jps(1)
103
104
105
106JDK 8 03 March 2015 jcmd(1)