{
    "mode": "man",
    "parameter": "jcmd",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/jcmd/1/json",
    "generated": "2026-06-17T13:15:48Z",
    "synopsis": "jcmd [-l|-h|-help]\njcmd pid|main-class PerfCounter.print\njcmd pid|main-class -f filename\njcmd pid|main-class command[ arguments]",
    "sections": {
        "NAME": {
            "content": "jcmd - Sends diagnostic command requests to a running Java Virtual Machine (JVM).\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "jcmd [-l|-h|-help]\n\njcmd pid|main-class PerfCounter.print\n\njcmd pid|main-class -f filename\n\njcmd pid|main-class command[ arguments]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The jcmd utility is used to send diagnostic command requests to the JVM. It must be used on\nthe same machine on which the JVM is running, and have the same effective user and group\nidentifiers that were used to launch the JVM.\n\nNote\n┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐\n│                                                                                                                            │\n│           To invoke diagnostic commands from a                                                                             │\n│           remote machine or with different                                                                                 │\n│           identifiers, you can use the                                                                                     │\n│           com.sun.management.DiagnosticCommandMBean                                                                        │\n│           interface. For more information about                                                                            │\n│           the DiagnosticCommandMBean interface,                                                                            │\n│           see the API documentation at                                                                                     │\n│           http://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/DiagnosticCommandMBean.html │\n└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘\n\nIf you run jcmd without arguments or with the -l option, it prints the list of running Java\nprocess identifiers with the main class and command-line arguments that were used to launch\nthe process. Running jcmd with the -h or -help option prints the tool’s help message.\n\nIf you specify the processes identifier (pid) or the main class (main-class) as the first\nargument, jcmd sends the diagnostic command request to the Java process with the specified\nidentifier or to all Java processes with the specified name of the main class. You can also\nsend the diagnostic command request to all available Java processes by specifying 0 as the\nprocess identifier. Use one of the following as the diagnostic command request:\n\nPerfcounter.print\nPrints the performance counters available for the specified Java process. The list of\nperformance counters might vary with the Java process.\n\n-f filename\nThe name of the file from which to read diagnostic commands and send them to the\nspecified Java process. Used only with the -f option. Each command in the file must be\nwritten on a single line. Lines starting with a number sign (#) are ignored. Processing\nof the file ends when all lines have been read or when a line containing the stop keyword\nis read.\n\ncommand [arguments]\nThe command to be sent to the specified Java process. The list of available diagnostic\ncommands for a given process can be obtained by sending the help command to this process.\nEach diagnostic command has its own set of arguments. To see the description, syntax, and\na list of available arguments for a command, use the name of the command as the argument\nfor the help command.\n\nNote: If any arguments contain spaces, you must surround them with single or double\nquotation marks (' or \"). In addition, you must escape single or double quotation marks\nwith a backslash (\\) to prevent the operating system shell from processing quotation\nmarks. Alternatively, you can surround these arguments with single quotation marks and\nthen with double quotation marks (or with double quotation marks and then with single\nquotation marks).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Options are mutually exclusive.\n\n-f filename\nReads commands from the specified file. This option can be used only if you specify the\nprocess identifier or the main class as the first argument. Each command in the file must\nbe written on a single line. Lines starting with a number sign (#) are ignored.\nProcessing of the file ends when all lines have been read or when a line containing the\nstop keyword is read.\n",
            "subsections": [
                {
                    "name": "-h",
                    "content": "",
                    "flag": "-h"
                },
                {
                    "name": "-help",
                    "content": "Prints a help message.\n"
                },
                {
                    "name": "-l",
                    "content": "Prints the list of running Java processes identifiers with the main class and\ncommand-line arguments.\n",
                    "flag": "-l"
                }
            ]
        },
        "SEE ALSO": {
            "content": "•   jps(1)\n\n\n\nJDK 8                                       03 March 2015                                    jcmd(1)",
            "subsections": []
        }
    },
    "summary": "jcmd - Sends diagnostic command requests to a running Java Virtual Machine (JVM).",
    "flags": [
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Prints a help message."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "Prints the list of running Java processes identifiers with the main class and command-line arguments."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "jps",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/jps/1/json"
        }
    ]
}