jcmd.1 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. '\" t
  2. .\" Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  3. .\"
  4. .\" Title: jcmd
  5. .\" Language: English
  6. .\" Date: 03 March 2015
  7. .\" SectDesc: Troubleshooting Tools
  8. .\" Software: JDK 8
  9. .\" Arch: generic
  10. .\" Part Number: E38209-04
  11. .\" Doc ID: JSSOR
  12. .\"
  13. .if n .pl 99999
  14. .TH "jcmd" "1" "03 March 2015" "JDK 8" "Troubleshooting Tools"
  15. .\" -----------------------------------------------------------------
  16. .\" * Define some portability stuff
  17. .\" -----------------------------------------------------------------
  18. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. .\" http://bugs.debian.org/507673
  20. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  21. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. .ie \n(.g .ds Aq \(aq
  23. .el .ds Aq '
  24. .\" -----------------------------------------------------------------
  25. .\" * set default formatting
  26. .\" -----------------------------------------------------------------
  27. .\" disable hyphenation
  28. .nh
  29. .\" disable justification (adjust text to left margin only)
  30. .ad l
  31. .\" -----------------------------------------------------------------
  32. .\" * MAIN CONTENT STARTS HERE *
  33. .\" -----------------------------------------------------------------
  34. .SH "NAME"
  35. jcmd \- Sends diagnostic command requests to a running Java Virtual Machine (JVM)\&.
  36. .SH "SYNOPSIS"
  37. .sp
  38. .if n \{\
  39. .RS 4
  40. .\}
  41. .nf
  42. \fBjcmd\fR [\fB\-l\fR|\fB\-h\fR|\fB\-help\fR]
  43. .fi
  44. .if n \{\
  45. .RE
  46. .\}
  47. .sp
  48. .if n \{\
  49. .RS 4
  50. .\}
  51. .nf
  52. \fBjcmd\fR \fIpid\fR|\fImain\-class\fR \fBPerfCounter\&.print\fR
  53. .fi
  54. .if n \{\
  55. .RE
  56. .\}
  57. .sp
  58. .if n \{\
  59. .RS 4
  60. .\}
  61. .nf
  62. \fBjcmd\fR \fIpid\fR|\fImain\-class\fR \fB\-f\fR \fIfilename\fR
  63. .fi
  64. .if n \{\
  65. .RE
  66. .\}
  67. .sp
  68. .if n \{\
  69. .RS 4
  70. .\}
  71. .nf
  72. \fBjcmd\fR \fIpid\fR|\fImain\-class\fR \fIcommand\fR[ \fIarguments\fR]
  73. .fi
  74. .if n \{\
  75. .RE
  76. .\}
  77. .SH "DESCRIPTION"
  78. .PP
  79. The
  80. \fBjcmd\fR
  81. utility is used to send diagnostic command requests to the JVM\&. It must be used on the same machine on which the JVM is running, and have the same effective user and group identifiers that were used to launch the JVM\&.
  82. .if n \{\
  83. .sp
  84. .\}
  85. .RS 4
  86. .it 1 an-trap
  87. .nr an-no-space-flag 1
  88. .nr an-break-flag 1
  89. .br
  90. .ps +1
  91. \fBNote\fR
  92. .ps -1
  93. .br
  94. .TS
  95. allbox tab(:);
  96. l.
  97. T{
  98. .PP
  99. To invoke diagnostic commands from a remote machine or with different identifiers, you can use the
  100. \fBcom\&.sun\&.management\&.DiagnosticCommandMBean\fR
  101. interface\&. For more information about the
  102. \fBDiagnosticCommandMBean\fR
  103. interface, see the API documentation at http://docs\&.oracle\&.com/javase/8/docs/jre/api/management/extension/com/sun/management/DiagnosticCommandMBean\&.html
  104. T}
  105. .TE
  106. .sp 1
  107. .sp .5v
  108. .RE
  109. .PP
  110. If you run
  111. \fBjcmd\fR
  112. without arguments or with the
  113. \fB\-l\fR
  114. option, it prints the list of running Java process identifiers with the main class and command\-line arguments that were used to launch the process\&. Running
  115. \fBjcmd\fR
  116. with the
  117. \fB\-h\fR
  118. or
  119. \fB\-help\fR
  120. option prints the tool\(cqs help message\&.
  121. .if n \{\
  122. .sp
  123. .\}
  124. .RS 4
  125. .it 1 an-trap
  126. .nr an-no-space-flag 1
  127. .nr an-break-flag 1
  128. .br
  129. .ps +1
  130. \fBNote\fR
  131. .ps -1
  132. .br
  133. .TS
  134. allbox tab(:);
  135. l.
  136. T{
  137. .PP
  138. The
  139. \fBjcmd\fR
  140. utility can be used to dynamically interact with Java Flight Recorder (JFR) in a JVM that is already running\&. You can use it to 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/javacomponents/jmc\&.htm
  141. T}
  142. .TE
  143. .sp 1
  144. .sp .5v
  145. .RE
  146. .PP
  147. If you specify the processes identifier (\fIpid\fR) or the main class (\fImain\-class\fR) as the first argument,
  148. \fBjcmd\fR
  149. 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\&. You can also send the diagnostic command request to all available Java processes by specifying
  150. \fB0\fR
  151. as the process identifier\&. Use one of the following as the diagnostic command request:
  152. .PP
  153. Perfcounter\&.print
  154. .RS 4
  155. Prints the performance counters available for the specified Java process\&. The list of performance counters might vary with the Java process\&.
  156. .RE
  157. .PP
  158. \-f \fIfilename\fR
  159. .RS 4
  160. The name of the file from which to read diagnostic commands and send them to the specified Java process\&. Used only with the
  161. \fB\-f\fR
  162. option\&. Each command in the file must be written on a single line\&. Lines starting with a number sign (\fB#\fR) are ignored\&. Processing of the file ends when all lines have been read or when a line containing the
  163. \fBstop\fR
  164. keyword is read\&.
  165. .RE
  166. .PP
  167. \fIcommand\fR [\fIarguments\fR]
  168. .RS 4
  169. The command to be sent to the specified Java process\&. The list of available diagnostic commands for a given process can be obtained by sending the
  170. \fBhelp\fR
  171. command to this process\&. Each diagnostic command has 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 argument for the
  172. \fBhelp\fR
  173. command\&.
  174. .sp
  175. \fBNote:\fR
  176. If any arguments contain spaces, you must surround them with single or double quotation marks (\fB\*(Aq\fR
  177. or
  178. \fB"\fR)\&. In addition, you must escape single or double quotation marks with a backslash (\fB\e\fR) to prevent the operating system shell from processing quotation marks\&. Alternatively, you can surround these arguments with single quotation marks and then with double quotation marks (or with double quotation marks and then with single quotation marks)\&.
  179. .RE
  180. .SH "OPTIONS"
  181. .PP
  182. Options are mutually exclusive\&.
  183. .PP
  184. \-f \fIfilename\fR
  185. .RS 4
  186. Reads commands from the specified file\&. This option can be used only if you specify the process identifier or the main class as the first argument\&. Each command in the file must be written on a single line\&. Lines starting with a number sign (\fB#\fR) are ignored\&. Processing of the file ends when all lines have been read or when a line containing the
  187. \fBstop\fR
  188. keyword is read\&.
  189. .RE
  190. .PP
  191. \-h
  192. .br
  193. \-help
  194. .RS 4
  195. Prints a help message\&.
  196. .RE
  197. .PP
  198. \-l
  199. .RS 4
  200. Prints the list of running Java processes identifiers with the main class and command\-line arguments\&.
  201. .RE
  202. .SH "SEE ALSO"
  203. .sp
  204. .RS 4
  205. .ie n \{\
  206. \h'-04'\(bu\h'+03'\c
  207. .\}
  208. .el \{\
  209. .sp -1
  210. .IP \(bu 2.3
  211. .\}
  212. jps(1)
  213. .RE
  214. .br
  215. 'pl 8.5i
  216. 'bp