jcmd,它是一个多功能的工具,可以用来实现前面除了jstat之外所有命令的功能。比如:用它来导出堆、内存的使用情况、查看java进程、导出线程信息、执行GC、JVM运行时间等。
- jcmd <java进程号> help:可以查看当前的java进程支持的命令
[root@iZbp19ryeo103aiogrb08mZ ~]# jcmd 7707 help 7707: The following commands are available: JFR.stop JFR.start JFR.dump JFR.check VM.native_memory VM.check_commercial_features VM.unlock_commercial_features ManagementAgent.stop ManagementAgent.start_local ManagementAgent.start VM.classloader_stats GC.rotate_log Thread.print GC.class_stats GC.class_histogram GC.heap_dump GC.finalizer_info GC.heap_info GC.run_finalization GC.run VM.uptime VM.dynlibs VM.flags VM.system_properties VM.command_line VM.version help For more information about a specific command use 'help <command>'.
其中,Thread.print就能打印当前java进程线程信息,GC.heap_dump就能导出当前java进程堆的信息等等