java命令行配置参数时,虚拟机参数需在类名前,类的接收参数需要在类名后,如下面的例子。
public class Hello {
public static void main(String[] args) {
System.out.println(args[0]);
}
}
输出:
>java -XX:+PrintGCDetails Hello 隔壁老王
隔壁老王
Heap
PSYoungGen total 57344K, used 1966K [0x0000000780900000, 0x0000000784900000, 0x00000007c0000000)
eden space 49152K, 4% used [0x0000000780900000,0x0000000780aeb9d8,0x0000000783900000)
from space 8192K, 0% used [0x0000000784100000,0x0000000784100000,0x0000000784900000)
to space 8192K, 0% used [0x0000000783900000,0x0000000783900000,0x0000000784100000)
ParOldGen total 131072K, used 0K [0x0000000701a00000, 0x0000000709a00000, 0x0000000780900000)
object space 131072K, 0% used [0x0000000701a00000,0x0000000701a00000,0x0000000709a00000)
Metaspace used 2546K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 279K, capacity 386K, committed 512K, reserved 1048576K