JVM HotSpot 虚拟机参数说明

Java HotSpot 虚拟机详细的启动命令行参数。基于 Java 8,用于 UnixWindows

提要 Synopsis

java [options] classname [args]

java [options] -jar filename [args]

javaw [options] classname [args] (Windows)

javaw [options] -jar filename [args] (Windows)

[options]
    命令行选项,以空格分隔。参见选项

    Command-line options separated by spaces. See Options.

[classname]
    启动的类名。

    The name of the class to be launched.

[filename]
    调用的JAR包的文件名,仅和 -jar 选项一同使用。

    The name of the Java Archive (JAR) file to be called. Used only with the -jar option.

[args]
    传递到main()方法中的参数,以空格分隔。

    The arguments passed to the main() method separated by spaces.

选项 Option

Java 命令支持众多的选项,可以被分为以下几类:

The java command supports a wide range of options that can be divided into the following categories:

Java 虚拟机(JVM)的所有实现都要确保支持标准选项。它们用于常见操作,例如检查 JRE 版本、设置类路径、启用详细输出等。

Standard options are guaranteed to be supported by all implementations of the Java Virtual Machine (JVM). They are used for common actions, such as checking the version of the JRE, setting the class path, enabling verbose output, and so on.

非标准选项是针对 Java HotSpot 虚拟机的通用选项,因此不能保证所有的 JVM 实现都支持它们,并有可能会发生变化。这些选项以 -X 开头。

Non-standard options are general purpose options that are specific to the Java HotSpot Virtual Machine, so they are not guaranteed to be supported by all JVM implementations, and are subject to change. These options start with -X.

不建议随意使用高级选项,这些开发者选项是用于调整 Java HotSpot 虚拟机操作的特定范围,这些范围通常有特定的系统要求,并有可能需要系统配置参数的访问权限。它们也不能被保证被所有的 JVM 实现支持,以及有可能会发生变化。高级选项以 -XX 开头。

Advanced options are not recommended for casual use. These are developer options used for tuning specific areas of the Java HotSpot Virtual Machine operation that often have specific system requirements and may require privileged access to system configuration parameters. They are also not guaranteed to be supported by all JVM implementations, and are subject to change. Advanced options start with -XX.

在文档末尾有一部分名为“弃置” Deprecated “删除” Removed 的选项,可以跟踪在最新版本中被弃用或删除的选项。

To keep track of the options that were deprecated or removed in the latest release, there is a section named Deprecated and Removed Options at the end of the document.

布尔选项用于启用默认禁用的功能或禁用默认启用的功能。这些选项不需要参数。布尔类的 -X 选项使用加号启用(-XX:+OptionName),以及使用减号禁用(-XX:-OptionName)。

Boolean options are used to either enable a feature that is disabled by default or disable a feature that is enabled by default. Such options do not require a parameter. Boolean -XX options are enabled using the plus sign (-XX:+OptionName) and disabled using the minus sign (-XX:-OptionName).

对于需要参数的选项,参数可以通过空格( )、冒号(:)或等号(=)与选项名分隔,或参数可以直接跟随选项(每个选项的确切语法不同)。如果以字节 Byte 为单位指定大小,可以不使用后缀,要么用 kK 表示千字节 Kilobyte KiB)、用 mM 表示兆字节 Megabyte MiB)、用 gG 表示吉字节 Gigabyte GiB)。例如,将大小设置为 8GiB,可以指定 8G8192M8388608K8589934592 作为参数。如果要指定百分比,则使用从 01 之间的数字(例如,指定 0.25 表示 25%)。

For options that require an argument, the argument may be separated from the option name by a space, a colon (:), or an equal sign (=), or the argument may directly follow the option (the exact syntax differs for each option). If you are expected to specify the size in bytes, you can use no suffix, or use the suffix k or K for kilobytes (KB), m or M for megabytes (MB), g or G for gigabytes (GB). For example, to set the size to 8 GB, you can specify either 8g, 8192m, 8388608k, or 8589934592 as the argument. If you are expected to specify the percentage, use a number from 0 to 1 (for example, specify 0.25 for 25%).

标准选项 Standard Options

这些是 JVM 的所有实现都支持的最常用选项。

These are the most commonly used options that are supported by all implementations of the JVM.

// TODO

参考链接

0%