JVM命令jps
jps是JVM的一个常用命令,类似linux中的ps命令。jps是查看java进程信息的命令;ps是查看linux系统中进程的命令
格式
jps [ options ] [ hostid ]
参数说明
options
-q 只输出java进程的进程id
-l 输出java进程的进程id和main方法的类全名
-m 输出java进程的进程id和main方法的入参
-v 输出java进程的进程id和jvm的入参
-V 输出java进程的进程id和通过flag文件传入jvm的参数
hostid
命令对应的服务器ip,默认不加参数,代码查看本机
实例
1 只输出进程id,其他后面命令都会带出这个信息
SZ-sten:Desktop sten$ jps -q
84257
83468
2 输出进程的类全称
SZ-sten:Desktop sten$ jps -l 84278 sun.tools.jps.Jps 83468 org.jetbrains.jps.cmdline.Launcher
3 输出方法的入参
SZ-lizhiliang:Desktop sten$ jps -m 83468 Launcher /Applications/IntelliJ IDEA.app/Contents/lib/javac2.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna.jar:/Applications/IntelliJ IDEA.app/Contents/lib/snappy-in-java-0.3.1.jar:/Applications/IntelliJ IDEA.app/Contents/lib/openapi.jar:/Applications/IntelliJ IDEA.app/Contents/lib/oromatcher.jar:/Applications/IntelliJ IDEA.app/Contents/lib/trove4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jps-builders.jar:/Applications/IntelliJ IDEA.app/Contents/lib/nanoxml-2.2.3.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jgoodies-forms.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jsr166e.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jdom.jar:/Applications/IntelliJ IDEA.app/Contents/lib/asm-all.jar:/Applications/IntelliJ IDEA.app/Contents/lib/picocontainer.jar:/Applications/IntelliJ IDEA.app/Contents/lib/protobuf-2.5.0.jar:/Applications/IntelliJ IDEA.app/Contents/lib/rt/jps-plugin-system.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna-platform.jar:/Applications/Intell 84298 Jps -m
4 输出方法的入参和方法的类的全称
SZ-lizhiliang:Desktop sten$ jps -ml 83468 org.jetbrains.jps.cmdline.Launcher /Applications/IntelliJ IDEA.app/Contents/lib/javac2.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna.jar:/Applications/IntelliJ IDEA.app/Contents/lib/snappy-in-java-0.3.1.jar:/Applications/IntelliJ IDEA.app/Contents/lib/openapi.jar:/Applications/IntelliJ IDEA.app/Contents/lib/oromatcher.jar:/Applications/IntelliJ IDEA.app/Contents/lib/trove4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jps-builders.jar:/Applications/IntelliJ IDEA.app/Contents/lib/nanoxml-2.2.3.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jgoodies-forms.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jsr166e.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jdom.jar:/Applications/IntelliJ IDEA.app/Contents/lib/asm-all.jar:/Applications/IntelliJ IDEA.app/Contents/lib/picocontainer.jar:/Applications/IntelliJ IDEA.app/Contents/lib/protobuf-2.5.0.jar:/Applications/IntelliJ IDEA.app/Contents/lib/rt/jps-plugin-system.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna-platform.jar:/Applications/Intell 84318 sun.tools.jps.Jps -ml
松下问童子,言师采药去。
只言此山中,云深不知处。