JVM配置参数之(-D、-X、-XX的区别)

JVM配置参数之(-D、-X、-XX的区别)

最近在学习jvm调优相关的内容, 一直有一个疑问,为什么有些参数是以-X开头的,有些是以-XX开头的,还有-D开头的?


通过查询资料、总结如下

-XX

说明:

标准选择(Standard Options)
这些是 JVM 的所有实现都支持的最常用的选项。

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

示例:

例如以-XX开头的配置参数
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnable
-XX:+UseFastAccessorMethods


-X

说明:

非标准选择(Non-Standard Options)
这些选项是特定于 Java HotSpot 虚拟机的通用选项。

These options are general purpose options that are specific to the Java HotSpot Virtual Machine.

示例:

例如以-X开头的配置参数
-Xmx256m
-Xms256m
-Xmn768m
-Xss256k


-D

说明:

设置系统属性值;
-D属性名称=属性值

Sets a system property value. The property variable is a string with no spaces that represents the name of the property. The value variable is a string that represents the value of the property. If value is a string with spaces, then enclose it in quotation marks (for example -Dfoo="foo bar").

示例:

例如以-D开头的配置参数
-Dspring.profiles.active=release
-Dspring.config.location=/opt/app/conf/

如果 属性值 是一个带有空格的字符串,那么用引号将其括起来
例如 -Dfoo = “ foo bar”


如果想进一步了解参数的详细信息,可以查阅Oracle官网
Oracle官网关于参数的说明

纸上得来终觉浅 绝知此事要躬行
原文地址:https://www.cnblogs.com/renyuanwei/p/14307711.html