如何使用jps -Joption

时间:2018-01-31 13:34:40

标签: java jvm

我真的无法弄清楚如何使用jsp -Joption。我的描述如下,

  

OPTIONS          jps命令支持许多修改命令输出的选项。这些选项可能会更改或删除          将来

   -q             Suppress the output of the class name, JAR file name, and arguments passed to the main method,  producing  only  a  list  of
                  local VM identifiers.

   -m             Output the arguments passed to the main method. The output may be null for embedded JVMs.

   -l             Output the full package name for the application's main class or the full path name to the application's JAR file.

   -v             Output the arguments passed to the JVM.

   -V             Output  the  arguments  passed  to  the  JVM  through  the  flags  file  (the  .hotspotrc  file or the file specified by the
                  -XX:Flags=<filename> argument).

   -Joption       Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes.  It  is  a
                  common convention for -J to pass options to the underlying VM executing applications written in Java.

实际上,我不知道什么是java launcher called by javac,当我使用jps -J-Xms48m运行示例jps时。那么,这个选项是什么?感谢。

1 个答案:

答案 0 :(得分:1)

jpsjstatjstackjmap等Java开发工具都是用Java编写的。就像常规Java程序一样,它们需要Java Runtime Environment,即它们在JVM下运行。

-J选项不会直接影响jps工具,但它们会影响运行此工具的JVM。例如。 -J-Xms48M选项意味着jps将启动Java虚拟机,初始堆大小为48兆字节。

例如,比较jps -J-XX:+PrintGCDetailsjps -J-Xms48M -J-XX:+PrintGCDetails