您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 临夏分类信息网,免费分类信息发布

jcmd工具在Java 9中的重要性是什么?

2024/3/13 10:25:51发布20次查看
“jcmd”是 jvm 诊断工具,它是一个命令行工具,用于在本地针对给定 jvm 运行诊断命令机器。该工具从java 7版本开始就包含在jdk安装中,可以用“%java_home%\bin\jcmd.exe”程序文件表示。如果我们在环境变量“path”中包含“%java_home%\bin”目录,我们可以运行“jcmd -h”命令来查看所有目录的完整列表选项如下
c:\users\user>jcmd -husage: jcmd or: jcmd -l or: jcmd -h command must be a valid jcmd command for the selected jvm. use the command "help" to see which commands are available. if the pid is 0, commands will be sent to all java processes. the main class argument will be used to match (either partially or fully) the class used to start java. if no options are given, lists java processes (same as -l). perfcounter.print display the counters exposed by this process -f read and execute commands from the file -l list jvm processes on the local machine -h this help
示例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) { } }}
输出free memory: 65454560total memory: 67108864
我们可以使用“jcmd -l”命令列出本地上所有正在运行的 jvm机器,然后使用输出中的 pid 或类 ma​​in 来识别 jvm。
c:\users\user>jcmd -l6108 jdk.jcmd/sun.tools.jcmd.jcmd -l
以上就是jcmd工具在java 9中的重要性是什么?的详细内容。
临夏分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录