Getting the parameters of a running JVM

前端 未结 12 606
栀梦
栀梦 2020-12-04 05:43

Is there a way to get the parameters of a running JVM? Is there a command line tool like jstat which takes as input the pid of the JVM and returns its starting parameters? I

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 06:13

    If you can do this in java, try:

    RuntimeMXBean

    ManagementFactory

    Example:

    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    List jvmArgs = runtimeMXBean.getInputArguments();
    for (String arg : jvmArgs) {
        System.out.println(arg);
    }
    

提交回复
热议问题