JVM 中 -、-X 参数和 -XX 参数有什么区别?
JVM 有很多参数。有些以-
开头,例如-server
、-client
。有些以-X
开头,例如-Xms
、-Xmx
。有些以-XX
开头,例如-XX:PermSize
、-XX:UseParallelGC
。
既然这些参数不重复,为什么要以这么多不同的前缀开头呢?为什么不直接使用-
。我的猜测是这有某种标准。 -XX
参数是扩展设置,并非所有 JVM 实现都支持。是这样吗?
There are lots of parameters for JVM. Some start with -
, such as -server
, -client
. Some start with -X
, such as -Xms
, -Xmx
. Some start with -XX
, such as -XX:PermSize
, -XX:UseParallelGC
.
Since these parameters are not duplicated, why start with so many different prefix? Why not just use -
. My guess is there are some kind of standards for this. The -XX
parameters are extension settings and not supported by all JVM impls. Is that so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以下是命令行参数选项的三个主要类别:
标准选项:以以下字符开头的选项- 标准选项预计会被所有 JVM 实现所接受,并且在版本之间保持稳定(尽管它们可能会被弃用)。
非标准选项:以 -X 开头的选项是非标准的(不保证在所有 JVM 实现上都受支持),并且可能会随时更改,恕不另行通知。请注意 Java SDK 的后续版本。
开发人员选项:以 -XX 开头的选项是开发人员选项,通常对正确操作有特定的系统要求,并且可能需要对系统配置参数的特权访问;不建议随意使用。这些选项也可能随时更改,恕不另行通知。
src
These are three main categories of Command-Line Argument options:
Standard options :Options that begin with - are Standard options are expected to be accepted by all JVM implementations and are stable between releases (though they can be deprecated).
Non-standard options :Options that begin with -X are non-standard (not guaranteed to be supported on all JVM implementations), and are subject to change without notice in subsequent releases of the Java SDK.
Developer options :Options that begin with -XX are developer options and often have specific system requirements for correct operation and may require privileged access to system configuration parameters; they are not recommended for casual use. These options are also subject to change without notice.
src
是的,这就是支持程度。未来版本支持普通(“-”)选项,但不支持 X。此外,XX选项“不建议随意使用”。
有关示例,请参阅 IBM 的 JVM 文档: http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.user.aix64.60%2Fdiag%2Fappendixes%2Fcmdline %2Fcommands_jvm.html
Yeah, its the level of support. The vanilla ("-") options are supported in future versions, and the X are not supported. Further, the XX options are "not recommended for casual use".
For an example, see IBM's JVM documentation: http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.user.aix64.60%2Fdiag%2Fappendixes%2Fcmdline%2Fcommands_jvm.html
Java 参考
Java Reference
java -help
:java -help
: