Java 9中的jcmd工具的重要性是什么?
示例
public class JCmdToolTest {
public static void main(String args[]) {
Runtime runtime = Runtime.getRuntime();
System.out.println("Free memory: " + runtime.freeMemory());
System.out.println("Total memory: " + runtime.totalMemory());
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
}
}
}我们可以使用“jcmd-l”命令列出本地计算机上所有正在运行的JVM,然后使用PID 或输出中的classmain 标识JVM。
C:\Users\User>jcmd -l6108 jdk.jcmd/sun.tools.jcmd.JCmd -l