JCMD(1)

πŸ“¦ version 23.0.2.0, in opensuse-leap 16.0

okay bestie, welcome to jcmd(1) from the JDK Commands manual πŸ’…βœ¨ this is the utility that sends diagnostic command requests to a running Java Virtual Machine (JVM), and we’re gonna get you fluent in it, no cap.

πŸŽ€ NAME πŸŽ€

jcmd β€” send diagnostic command requests to a running Java Virtual Machine (JVM). That’s the whole vibe. 🫢


✨ SYNOPSIS ✨

jcmd [pid | main-class] command...  | PerfCounter.print | -f filename

jcmd [-l]

jcmd -h
  • pid β€” when you use this, jcmd sends the diagnostic command request to the process ID for the Java process. πŸ’…
  • main-class β€” when you use this, jcmd sends the diagnostic command request to all Java processes with the specified name of the main class. iconic behavior.
  • command β€” the command has to be a valid jcmd command for the selected JVM. You get the list of available commands for jcmd by running the help command (jcmd pid help), where pid is the process ID for the running Java process. 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, it lists the running Java process identifiers with the main class and command-line arguments that were used to launch the process (the same as using -l). ✨
  • Perfcounter.print β€” prints the performance counters exposed by the specified Java process. πŸ“
  • -f filename β€” reads and executes commands from a specified file, filename. πŸ“
  • -l β€” displays the list of Java Virtual Machine process identifiers that are not running in a separate docker process, along with the main class and command-line arguments that were used to launch the process. If the JVM is in a docker process, you must use tools such as ps to look up the PID. lowkey important.
Note: using jcmd without arguments is the same as using jcmd -l. periodt. πŸ’–
  • -h β€” displays the jcmd utility’s command-line help. πŸŽ€

🌸 DESCRIPTION 🌸

The jcmd 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 it must have the same effective user and group identifiers that were used to launch the JVM. 🫢

Each diagnostic command has its own set of arguments. To display the description, syntax, and a list of available arguments for a diagnostic command, use the name of the command as the argument. For example:

jcmd pid help command

If arguments contain spaces, then you must surround them with single or double quotation marks (' or "). In addition, you must escape single or double quotation marks with a backslash (\) 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). the way that little shell-quoting dance matters 😭

If you specify the process identifier (pid) or the main class (main-class) as the first argument, then the jcmd utility 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 0 as the process identifier. πŸ‘‘


🌈 COMMANDS FOR JCMD 🌈

The command must be a valid jcmd diagnostic command for the selected JVM. The list of available commands for jcmd is obtained by running the help command (jcmd pid help), where pid is the process ID for a running Java process. 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, it lists the running Java process identifiers that are not in separate docker processes, along with the main class and command-line arguments that were used to launch the process (the same as using -l). πŸ’…

The following commands are available:

πŸ› οΈ help [options] [arguments]

For more information about a specific command.

arguments:

  • command name β€” the name of the command for which we want help (STRING, no default value)
Note: the following options must be specified using either key or key=value syntax.

options:

  • -all β€” (Optional) Show help for all commands (BOOLEAN, false). ✨

πŸ› οΈ Compiler.CodeHeap_Analytics [function] [granularity]

Print CodeHeap analytics.

Impact: Low: Depends on code heap size and content. Holds CodeCache_lock during analysis step, usually sub-second duration.

arguments:

  • function β€” (Optional) Function to be performed (aggregate, UsedSpace, FreeSpace, MethodCount, MethodSpace, MethodAge, MethodNames, discard) (STRING, all)
  • granularity β€” (Optional) Detail level β€” smaller value -> more detail (INT, 4096)

πŸ› οΈ Compiler.codecache

Prints code cache layout and bounds.

Impact: Low

πŸ› οΈ Compiler.codelist

Prints all compiled methods in code cache that are alive.

Impact: Medium

πŸ› οΈ Compiler.directives_add arguments

Adds compiler directives from a file.

Impact: Low

arguments:

  • filename β€” the name of the directives file (STRING, no default value)

πŸ› οΈ Compiler.directives_clear

Remove all compiler directives.

Impact: Low

πŸ› οΈ Compiler.directives_print

Prints all active compiler directives.

Impact: Low

πŸ› οΈ Compiler.directives_remove

Remove latest added compiler directive.

Impact: Low

πŸ› οΈ Compiler.memory [options]

Print compilation footprint.

Impact: Medium: Pause time depends on number of compiled methods.

Note: the options must be specified using either key or key=value syntax.

options:

  • -H β€” (Optional) Human readable format (BOOLEAN, false)
  • -s β€” (Optional) Minimum memory size (MEMORY SIZE, 0)

πŸ› οΈ Compiler.perfmap [arguments] (Linux only)

Write map file for Linux perf tool.

Impact: Low

arguments:

  • filename β€” (Optional) The name of the map file (STRING, /tmp/perf-<pid>.map)

If filename is not specified, a default file name is chosen using the pid of the target JVM process. For example, if the pid is 12345, then the default filename will be /tmp/perf-12345.map. πŸ“

πŸ› οΈ Compiler.queue

Prints methods queued for compilation.

Impact: Low

πŸ› οΈ GC.class_histogram [options]

Provides statistics about the Java heap usage.

Impact: High --- depends on Java heap size and content. 😭

Note: the options must be specified using either key or key=value syntax.

options:

  • -all β€” (Optional) Inspects all objects, including unreachable objects (BOOLEAN, false)
  • -parallel β€” (Optional) Number of parallel threads to use for heap inspection. 0 (the default) means let the VM determine the number of threads to use. 1 means use one thread (disable parallelism). For any other value the VM will try to use the specified number of threads, but might use fewer. (INT, 0)

πŸ› οΈ GC.finalizer_info

Provides information about the Java finalization queue.

Impact: Medium

πŸ› οΈ GC.heap_dump [options] [arguments]

Generates a HPROF format dump of the Java heap.

Impact: High --- depends on the Java heap size and content. Request a full GC unless the -all option is specified. πŸ”₯

Note: the following options must be specified using either key or key=value syntax.

options:

  • -all β€” (Optional) Dump all objects, including unreachable objects (BOOLEAN, false)
  • -gz β€” (Optional) If specified, the heap dump is written in gzipped format using the given compression level. 1 (recommended) is the fastest, 9 the strongest compression. (INT, 1)
  • -overwrite β€” (Optional) If specified, the dump file will be overwritten if it exists (BOOLEAN, false)
  • -parallel β€” (Optional) Number of parallel threads to use for heap dump. The VM will try to use the specified number of threads, but might use fewer. (INT, 1)

arguments:

  • filename β€” the name of the dump file (STRING, no default value)

πŸ› οΈ GC.heap_info

Provides generic Java heap information.

Impact: Medium

πŸ› οΈ GC.run

Calls java.lang.System.gc().

Impact: Medium --- depends on the Java heap size and content.

πŸ› οΈ GC.run_finalization

Calls java.lang.System.runFinalization().

Impact: Medium --- depends on the Java content.

πŸ› οΈ JFR.check [options]

Show information about a running flight recording.

Impact: Low

Note: the options must be specified using either key or key=value syntax. If no parameters are entered, information for all active recordings is shown.

options:

  • name β€” (Optional) Name of the flight recording. (STRING, no default value)
  • verbose β€” (Optional) Flag for printing the event settings for the recording (BOOLEAN, false)

πŸ› οΈ JFR.configure [options]

Set the parameters for a flight recording.

Impact: Low

Note: the options must be specified using either key or key=value syntax. If no parameters are entered, the current settings are displayed.

options:

  • dumppath β€” (Optional) Path to the location where a recording file is written in case the VM runs into a critical error, such as a system crash. (STRING, The default location is the current directory)
  • globalbuffercount β€” (Optional) Number of global buffers. This option is a legacy option: change the memorysize parameter to alter the number of global buffers. This value cannot be changed once JFR has been initialized. (STRING, default determined by the value for memorysize)
  • globalbuffersize β€” (Optional) Size of the global buffers, in bytes. This option is a legacy option: change the memorysize parameter to alter the size of the global buffers. This value cannot be changed once JFR has been initialized. (STRING, default determined by the value for memorysize)
  • maxchunksize β€” (optional) the max size of one single data chunk, in bytes, unless you use one of these suffixes: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. Heads up: you literally cannot change this once JFR has been initialized. (STRING, 12M)
  • memorysize β€” (optional) the overall memory size, in bytes unless you slap on one of these suffixes: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. Also locked in forever once JFR has been initialized, no take-backs. (STRING, 10M)
  • repositorypath β€” (optional) the path to where recordings hang out until they get written to a permanent file. (STRING, and the default is your OS's temporary directory β€” on Linux that's /tmp, and on Windwows it's whatever the TMP environment variable says 😭 yes bestie that's genuinely how the page spells it, I'm not making this up)
  • preserve-repository={true|false} β€” says whether files chillin' in the disk repository should be kept after the JVM has exited. If false, they get deleted. Disabled by default. πŸ’…
  • stackdepth β€” (optional) the stack depth for stack traces. Setting this bigger than the default 64 may cause a performance degradation, so like… be mindful. Cannot be changed once JFR has been initialized. (LONG, 64)
  • thread_buffer_size β€” (optional) local buffer size for each thread, in bytes unless you use one of these suffixes: 'k' or 'K' for kilobytes or 'm' or 'M' for megabytes. Overriding this could reduce performance and is not recommended β€” the page said it, not me. Cannot be changed once JFR has been initialized. (STRING, 8k)
  • samplethreads β€” (optional) flag for turning on thread sampling. (BOOLEAN, true)

πŸ¦‹ JFR.dump [options] πŸ¦‹

Writes data out to a file while a flight recording is actively running. Very "screenshot the group chat mid-conversation" energy.

Impact: Low ✨

Note: you've gotta specify the options using either the key or key=value syntax. No options are required tho. And the recording keeps running after the data is written β€” nothing gets interrupted, we love that for you. πŸ’–

options:

  • begin β€” (optional) the time from which recording data will be included in the dump file. The format is specified as local time. (STRING, no default value)
  • end β€” (optional) the time to which recording data will be included in the dump file. The format is specified as local time. (STRING, no default value)
Note: for both begin and end, the time has to be in a format readable by java.time.LocalTime::parse(STRING), java.time.LocalDateTime::parse(STRING) or java.time.Instant::parse(STRING). Like, for example, "13:20:15", "2020-03-17T09:00:00" or "2020-03-17T09:00:00Z".
Note: begin and end times correspond to the timestamps found within the recorded information in the flight recording data. iykyk.

Another option (and this one's lowkey the fun one): use a time relative to the current time, specified by a negative integer followed by "s", "m" or "h". For example, "-12h", "-15m" or "-30s".

  • filename β€” (optional) name of the file the flight recording data gets dumped into. If no filename is given, one gets generated from the PID and the current date. The filename may also be a directory, in which case the filename is generated from the PID and the current date inside that specified directory. If %p and/or %t shows up in the filename, it expands to the JVM's PID and the current timestamp respectively β€” lil magic trick, iconic. (STRING, no default value)
  • maxage β€” (optional) length of time for dumping the flight recording data to a file. (INTEGER followed by 's' for seconds, 'm' for minutes or 'h' for hours, no default value)
  • maxsize β€” (optional) maximum size for the amount of data to dump from a flight recording, in bytes unless one of the following suffixes is used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. (STRING, no default value)
  • name β€” (optional) name of the recording. If no name is given, data from all recordings is dumped β€” every last one, no crumbs. (STRING, no default value)
  • path-to-gc-roots β€” (optional) flag for saving the path to garbage collection (GC) roots at the time the recording data is dumped. That path info is genuinely useful for finding memory leaks, BUT collecting it can cause the application to pause for a short period of time. So only turn this flag on when you have an application you suspect has a memory leak. (BOOLEAN, false)

πŸŽ€ JFR.start [options] πŸŽ€

Starts a flight recording. The main character of the JFR commands ngl.

Impact: Low ✨

Note: the options must be specified using either key or key=value syntax. And if you enter no parameters at all, a recording just starts with default values β€” she's ready with zero input. 🫢

options:

  • delay β€” (optional) length of time to wait before starting to record. (INTEGER followed by 's' for seconds, 'm' for minutes or 'h' for hours, 0s)
  • disk β€” (optional) flag for also writing the data to disk while recording. (BOOLEAN, true)
  • dumponexit β€” (optional) flag for writing the recording to disk when the Java Virtual Machine (JVM) shuts down. If set to 'true' and no value is given for filename, the recording is written to a file in the directory where the process was started. The file name is a system-generated name that contains the process ID, the recording ID and the current time stamp. (For example: id-1-2019_12_12_10_41.jfr) (BOOLEAN, false)
  • duration β€” (optional) length of time to record. Note that 0s means forever β€” we love an infinite era. (INTEGER followed by 's' for seconds, 'm' for minutes or 'h' for hours, 0s)
  • filename β€” (optional) name of the file the flight recording data is written to when the recording is stopped. If no filename is given, a filename is generated from the PID and the current date and placed in the directory where the process was started. The filename may also be a directory, in which case the filename is generated from the PID and the current date in the specified directory. If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp respectively. (STRING, no default value)
  • maxage β€” (optional) maximum time to keep the recorded data on disk. This parameter is valid only when the disk parameter is set to true. Note 0s means forever. (INTEGER followed by 's' for seconds, 'm' for minutes or 'h' for hours, 0s)
  • maxsize β€” (optional) maximum size of the data to keep on disk, in bytes unless one of the following suffixes is used: 'm' or 'M' for megabytes OR 'g' or 'G' for gigabytes. This parameter is valid only when the disk parameter is set to 'true'. The value must not be less than the value for the maxchunksize parameter set with the JFR.configure command β€” so check that first, bestie. (STRING, 0 (no maximum size))
  • name β€” (optional) name of the recording. If no name is provided, one is generated. Make note of the generated name shown in the response to the command so you can use it with other commands β€” write it down, screenshot it, tattoo it, whatever works. (STRING, system-generated default name)
  • path-to-gc-roots β€” (optional) flag for saving the path to garbage collection (GC) roots at the end of a recording. The path info is useful for finding memory leaks but collecting it is time consuming. Turn on this flag only when you have an application that you suspect has a memory leak. If the settings parameter is set to 'profile', then the information collected includes the stack trace from where the potential leaking object was allocated. (BOOLEAN, false)
  • settings β€” (optional) name of the settings file that identifies which events to record. To specify more than one file, separate the names with a comma (,). Include the path if the file is not in JAVA-HOME/lib/jfr. The following profiles are included with the JDK in the JAVA-HOME/lib/jfr directory: 'default.jfc' collects a predefined set of information with low overhead, so it has minimal impact on performance and can be used with recordings that run continuously; 'profile.jfc' provides more data than the 'default.jfc' profile, but with more overhead and impact on performance β€” use this configuration for short periods of time when more information is needed. Use none to start a recording without a predefined configuration file. (STRING, JAVA-HOME/lib/jfr/default.jfc)

Event settings and .jfc options can be specified using the following syntax:

  • option β€” (optional) specifies the option value to modify. To list available options, use the JAVA_HOME/bin/jfr tool. πŸ‘‘
  • event-setting β€” (optional) specifies the event setting value to modify. Use the form: <event-name>#<setting-name>=<value>. To add a new event setting, prefix the event name with '+'.

You can specify values for multiple event settings and .jfc options by separating them with a whitespace. In case of a conflict between a parameter and a .jfc option, the parameter will take precedence β€” parameter ate and left no crumbs. The whitespace delimiter can be omitted for timespan values, i.e. 20ms. For more information about the settings syntax, see Javadoc of the jdk.jfr package.


🌈 JFR.stop [options] 🌈

Stops a flight recording. The "okay we're wrapping up" of the JFR sequence.

Impact: Low ✨

Note: options must be specified using either key or key=value syntax. And if no parameters are entered, then no recording is stopped β€” awkward silence, nothing happens. 😭

options:

  • filename β€” (optional) name of the file the recording is written to when the recording is stopped. If %p and/or %t is specified in the filename, it expands to the JVM's PID and the current timestamp respectively. If no path is provided, the data from the recording is discarded β€” gone, poof, deleted without a trace. (STRING, no default value)
  • name β€” (optional) what you wanna call this recording, bestie. STRING, no default value, so like... name it yourself πŸ’…

JFR.view [options]

Shows you event data in these cute predefined views. It's giving "dashboard but make it JVM" ✨

Impact: Medium

Heads up: the options have to be written as either key or key=value. If you pass literally nothing, it just prints out a list of all the views you can pick from. Free menu, no cap πŸ“

options:

  • cell-height β€” (optional) the maximum number of rows in a table cell. INT, and the default depends on which view you're looking at.
  • maxage β€” (optional) how far back in time the view reaches. INT followed by s for seconds, m for minutes, or h for hours. Default is 10m.
  • maxsize β€” (optional) the maximum size the view spans, in bytes β€” unless you use one of these suffixes: m or M for megabytes, OR g or G for gigabytes. STRING, default value is 32MB.
  • truncate β€” (optional) the maximum number of rows in a table cell. INT, default value depends on the view.
  • verbose β€” (optional) shows you the query that actually makes up the view. BOOLEAN, default value is false.
  • width β€” (optional) the width of the view, in characters. INT, default value depends on the view.

arguments:

  • view β€” the name of the view or event type you want to display. Run help JFR.view to see the list of available views. STRING, no default value.

Lowkey the view parameter can also be an event type name β€” use JFR.view types to see that list. Wanna see everything? JFR.view all-views for all the views, JFR.view all-events for all the events. Iconic. πŸ‘‘


JVMTI.agent_load [arguments]

Loads a JVMTI native agent. 🧚

Impact: Low

arguments:

  • library path β€” the absolute path of the JVMTI agent you're loading. STRING, no default value.
  • agent option β€” (optional) an option string to pass along to the agent. STRING, no default value.

JVMTI.data_dump

Signals the JVM to do a data-dump request for JVMTI.

Impact: High

Not me warning you β€” this one's High impact, so maybe don't spam it, bestie 😭

ManagementAgent.start [options]

Starts the remote management agent. 🫢

Impact: Low β€” no impact

Note: the following options must be specified using either key or key=value syntax. No improvising πŸ’…

options:

  • config.file β€” (optional) sets com.sun.management.config.file. STRING, no default value.
  • jmxremote.host β€” (optional) sets com.sun.management.jmxremote.host. STRING, no default value.
  • jmxremote.port β€” (optional) sets com.sun.management.jmxremote.port. STRING, no default value.
  • jmxremote.rmi.port β€” (optional) sets com.sun.management.jmxremote.rmi.port. STRING, no default value.
  • jmxremote.ssl β€” (optional) sets com.sun.management.jmxremote.ssl. STRING, no default value.
  • jmxremote.registry.ssl β€” (optional) sets com.sun.management.jmxremote.registry.ssl. STRING, no default value.
  • jmxremote.authenticate β€” (optional) sets com.sun.management.jmxremote.authenticate. STRING, no default value.
  • jmxremote.password.file β€” (optional) sets com.sun.management.jmxremote.password.file. STRING, no default value.
  • jmxremote.access.file β€” (optional) sets com.sun.management.jmxremote.access.file. STRING, no default value.
  • jmxremote.login.config β€” (optional) sets com.sun.management.jmxremote.login.config. STRING, no default value.
  • jmxremote.ssl.enabled.cipher.suites β€” (optional) sets com.sun.management.
  • jmxremote.ssl.enabled.cipher.suite β€” STRING, no default value.
  • jmxremote.ssl.enabled.protocols β€” (optional) sets com.sun.management.jmxremote.ssl.enabled.protocols. STRING, no default value.
  • jmxremote.ssl.need.client.auth β€” (optional) sets com.sun.management.jmxremote.need.client.auth. STRING, no default value.
  • jmxremote.ssl.config.file β€” (optional) sets com.sun.management.jmxremote.ssl_config_file. STRING, no default value.
  • jmxremote.autodiscovery β€” (optional) sets com.sun.management.jmxremote.autodiscovery. STRING, no default value.
  • jdp.port β€” (optional) sets com.sun.management.jdp.port. INT, no default value.
  • jdp.address β€” (optional) sets com.sun.management.jdp.address. STRING, no default value.
  • jdp.source_addr β€” (optional) sets com.sun.management.jdp.source_addr. STRING, no default value.
  • jdp.ttl β€” (optional) sets com.sun.management.jdp.ttl. INT, no default value.
  • jdp.pause β€” (optional) sets com.sun.management.jdp.pause. INT, no default value.
  • jdp.name β€” (optional) sets com.sun.management.jdp.name. STRING, no default value.

ManagementAgent.start_local

Starts the local management agent. Same vibe, closer to home 🏠

Impact: Low β€” no impact


ManagementAgent.status

Prints the management agent status. Just a lil status update, iykyk 🌸

Impact: Low β€” no impact


ManagementAgent.stop

Stops the remote management agent. Bye bestie πŸ‘‹

Impact: Low β€” no impact


System.dump_map [options] (Linux only)

Dumps an annotated process memory map to an output file. Linux girlies only 🐧

Impact: Low

Note: the following options must be specified using either key or key=value syntax.

options:

  • -H β€” (optional) human readable format. BOOLEAN, false.
  • -F β€” (optional) file path. STRING, "vm_memory_map_.txt".

System.map [options] (Linux only)

Prints an annotated process memory map of the VM process. (Linux only, again β€” sorry macOS besties πŸ’€)

Impact: Low

Note: the following options must be specified using either key or key=value syntax.

options:

  • -H β€” (optional) human readable format. BOOLEAN, false.

System.native_heap_info (Linux only)

Tries to output info about native heap usage via malloc_info(3). If it doesn't work out, it prints "Error: " and then a reason. We love a graceful fail 🫢

Impact: Low


System.trim_native_heap (Linux only)

Tries to free up memory by trimming the C-heap. Decluttering era ✨

Impact: Low


Thread.dump_to_file [options] filepath

Dumps threads β€” stack traces and all β€” into a file, as plain text or JSON. πŸ’œ

Impact: Medium β€” depends on the number of threads.

Note: the following options must be specified using either key or key=value syntax.

options:

  • -overwrite β€” (optional) may overwrite an existing file. BOOLEAN, false.
  • -format β€” (optional) output format, either "plain" or "json". STRING, plain.

arguments:

  • filepath β€” the file path to the output file. STRING, no default value.

Thread.print [options]

Prints all the threads, with stacktraces. The classic, the icon, the main character πŸ‘‘

Impact: Medium β€” depends on the number of threads.

Note: the following options must be specified using either key or key=value syntax.

options:

  • -e β€” (optional) print extended thread information. BOOLEAN, false.
  • -l β€” (optional) prints java.util.concurrent locks. BOOLEAN, false.

VM.cds [arguments]

Dumps a static or dynamic shared archive that includes every currently loaded class. πŸŽ€

Impact: Medium β€” pause time depends on number of loaded classes

arguments:

  • subcmd β€” has to be either static_dump or dynamic_dump. STRING, no default value.
  • filename β€” (optional) name of the shared archive to be dumped. STRING, java_pid<pid>_<subcmd>.jsa.

If you don't give a filename, a default file name gets picked using the pid of the target JVM process. For example: java_pid1234_static.jsa, java_pid5678_dynamic.jsa, etc. Cute, right? πŸ¦‹

If filename isn't an absolute path, the archive file is created in a directory relative to the current directory of the target JVM process.

If you go with dynamic_dump, the target JVM must be started with the JVM option -XX:+RecordDynamicDumpInfo. No cap, it just has to. πŸ”₯


VM.class_hierarchy [options] [arguments]

Prints a list of all loaded classes, indented so you can actually see the class hierarchy. Each class name is followed by the ClassLoaderData* of its ClassLoader β€” or "null" if it's loaded by the bootstrap class loader. It's giving family tree πŸ’…

Impact: Medium β€” depends on the number of loaded classes.

Note: the following options must be specified using either key or key=value syntax.

options:

  • -i β€” (optional) inherited interfaces should be printed. BOOLEAN, false.
  • -s β€” (optional) if a classname is specified, print its subclasses in addition to its superclasses. Without this option, only the superclasses get printed. BOOLEAN, false.

arguments:

  • classname β€” (optional) the name of the class whose hierarchy should be printed. If you don't specify it, all class hierarchies get printed. STRING, no default value.

VM.classes [options]

Prints all loaded classes. All of them. Every single one 🫢

Impact: Medium β€” depends on number of loaded classes.

The following options must be specified using either key or key=value syntax.

options:

  • -verbose β€” (optional) dump the detailed content of a Java class. Some classes are annotated with flags: F = has, or inherits, a non-empty finalize method, f = has final method, W = methods rewritten, C = marked with @Contended annotation, R = has been redefined, S = is shared class. BOOLEAN, false.
Not me memorizing the flag lore: F, f, W, C, R, S. That's the whole alphabet arc 😭

VM.classloader_stats

Prints statistics about all ClassLoaders. Numbers, but make it classloader gossip πŸ’€

Impact: Low


VM.classloaders [options]

Prints the classloader hierarchy. It's giving ancestry dot com 🌈

Impact: Medium β€” depends on number of class loaders and classes loaded.

The following options must be specified using either key or key=value syntax.

options:

  • show-classes β€” (optional) print loaded classes. BOOLEAN, false.
  • verbose β€” (optional) print detailed information. BOOLEAN, false.
  • fold β€” (optional) show loaders of the same name and class as one. BOOLEAN, true.

VM.command_line πŸ’»

Prints the command line that was used to start this VM instance. fr fr, the whole origin story. ✨

Impact: Low


VM.dynlibs πŸ“š

Prints all the loaded dynamic libraries. lowkey a library haul. πŸ›οΈ

Impact: Low


VM.events [options] πŸͺ΅

Prints the VM event logs. it's giving storytime but make it system events. πŸ“–

Impact: Low β€” Depends on event log size.

Options:

Note: The following options must be specified using either key or key=value syntax.
  • log β€” (Optional) Name of log to be printed. If omitted, all logs are printed. (STRING, no default value)
  • max β€” (Optional) Maximum number of events to be printed (newest first). If omitted, all events are printed. (STRING, no default value)

VM.flags [options] 🚩

Prints all the VM flag options and what their current values are. flag haul, basically. πŸ΄β€β˜ οΈ

Impact: Low

Note: The following options must be specified using either key or key=value syntax.

Options:

  • -all β€” (Optional) Prints all flags supported by the VM (BOOLEAN, false).

VM.info ✨

Prints all the info about the JVM environment and its current status. the JVM's whole vibe check. 🫢

Impact: Low


VM.log [options] πŸͺ΅

Lists your current log config, turns logging on/off, configures a log output, or rotates all the logs. log slay. πŸ’…

Impact: Low

Options:

Note: The following options must be specified using either key or key=value syntax.
  • output β€” (Optional) The name or index (#) of output to configure. (STRING, no default value)
  • output_options β€” (Optional) Options for the output. (STRING, no default value)
  • what β€” (Optional) Configures what tags to log. (STRING, no default value)
  • decorators β€” (Optional) Configures which decorators to use. Use 'none' or an empty value to remove all. (STRING, no default value)
  • disable β€” (Optional) Turns off all logging and clears the log configuration. (BOOLEAN, no default value)
  • list β€” (Optional) Lists current log configuration. (BOOLEAN, no default value)
  • rotate β€” (Optional) Rotates all logs. (BOOLEAN, no default value)

VM.metaspace [options] 🧠

Prints all the stats for the metaspace. big brain memory energy. 🧚

Impact: Medium β€” Depends on number of classes loaded.

Note: The following options must be specified using either key or key=value syntax.

Options:

  • basic β€” (Optional) Prints a basic summary (does not need a safepoint). (BOOLEAN, false)
  • show-loaders β€” (Optional) Shows usage by class loader. (BOOLEAN, false)
  • show-classes β€” (Optional) If show-loaders is set, shows loaded classes for each loader. (BOOLEAN, false)
  • by-chunktype β€” (Optional) Break down numbers by chunk type. (BOOLEAN, false)
  • by-spacetype β€” (Optional) Break down numbers by loader type. (BOOLEAN, false)
  • vslist β€” (Optional) Shows details about the underlying virtual space. (BOOLEAN, false)
  • chunkfreelist β€” (Optional) Shows details about global chunk free lists (ChunkManager). (BOOLEAN, false)
  • scale β€” (Optional) Memory usage in which to scale. Valid values are: 1, KB, MB or GB (fixed scale) or "dynamic" for a dynamically chosen scale. (STRING, dynamic)

VM.native_memory [options] πŸ’Ύ

Prints native memory usage. memory tea, served fresh. β˜•

Impact: Medium

Note: The following options must be specified using either key or key=value syntax.

Options:

  • summary β€” (Optional) Requests runtime to report current memory summary, which includes total reserved and committed memory, along with memory usage summary by each subsystem. (BOOLEAN, false)
  • detail β€” (Optional) Requests runtime to report memory allocation >= 1K by each callsite. (BOOLEAN, false)
  • baseline β€” (Optional) Requests runtime to baseline current memory usage, so it can be compared against in later time. (BOOLEAN, false)
  • summary.diff β€” (Optional) Requests runtime to report memory summary comparison against previous baseline. (BOOLEAN, false)
  • detail.diff β€” (Optional) Requests runtime to report memory detail comparison against previous baseline, which shows the memory allocation activities at different callsites. (BOOLEAN, false)
  • statistics β€” (Optional) Prints tracker statistics for tuning purpose. (BOOLEAN, false)
  • scale β€” (Optional) Memory usage in which scale, KB, MB or GB (STRING, KB)

VM.set_flag [arguments] 🚩

Sets a VM flag using the value you hand it. flag glow-up. πŸ’…

Impact: Low

Arguments:

  • flag name β€” The name of the flag that you want to set (STRING, no default value)
  • string value β€” (Optional) The value that you want to set (STRING, no default value)

VM.stringtable [options] 🧡

Dumps the string table. string theory but make it JVM. πŸͺ‘

Impact: Medium β€” depends on the Java content.

Note: The following options must be specified using either key or key=value syntax.

Options:

  • -verbose β€” (Optional) Dumps the content of each string in the table (BOOLEAN, false)

VM.symboltable [options] πŸ”£

Dumps the symbol table. symbol slay. πŸͺ„

Impact: Medium β€” depends on the Java content.

Note: The following options must be specified using either key or key=value syntax.

Options:

  • -verbose β€” (Optional) Dumps the content of each symbol in the table (BOOLEAN, false)

VM.system_properties 🏷️

Prints the system properties. all the system tea. 🍡

Impact: Low


VM.systemdictionary πŸ—‚οΈ

Prints stats for dictionary hashtable sizes and bucket length. hashtable hot goss. πŸ’…

Impact: Medium

Note: The following options must be specified using either key or key=value syntax.

Options:

  • verbose β€” (Optional) Dump the content of each dictionary entry for all class loaders (BOOLEAN, false)

VM.uptime [options] ⏱️

Prints how long the VM has been up. the VM's screen time. 🎬

Impact: Low

Note: The following options must be specified using either key or key=value syntax.

Options:

  • -date β€” (Optional) Adds a prefix with the current date (BOOLEAN, false)

VM.version 🏷️

Prints the JVM version information. the JVM's birth certificate. πŸ“œ

Impact: Low


and that's the whole page, bestie! πŸ’– this slay manual is from JDK 23, dated 2024, and it's the JCMD(1) page β€” periodt. go off and jcmd responsibly! 🫢✨

πŸ“¦ where this page comes from