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官網關於參數的說明