JDK命令行工具

1 jps: jps命令可以方便的查看进程id,启动类,传入参数, jvm参数

jps命令类似于linux 下的ps,但是只列出java的进程. 直接运行jps不加参数,会列出java程序的进场ID,及main函数名称

C:\Users\shj>jps
42340 Jps
41064
42040 JucApplication
37804 Launcher

可以看到,目前有4个java进程

-q 可以让jps只查看进程ID


C:\Users\shj>jps -q
25972
41064
42040
37804

-m 可以输出传递给java进场(main方法) 的参数

C:\Users\shj>jps -m
40884 Jps -m
41064
42040 JucApplication
37804 Launcher D:/IDEA2020/lib/plexus-interpolation-1.25.jar;D:/IDEA2020/lib/netty-resolver-4.1.52.Final.jar;D:/IDEA2020/lib/lz4-java-1.7.1.jar;D:/IDEA2020/lib/plexus-component-annotations-1.7.1.jar;D:/IDEA2020/lib/platform-api.jar;D:/IDEA2020/lib/forms_rt.jar;D:/IDEA2020/lib/netty-codec-4.1.52.Final.jar;D:/IDEA2020/lib/oro-2.0.8.jar;D:/IDEA2020/lib/netty-buffer-4.1.52.Final.jar;D:/IDEA2020/lib/netty-transport-4.1.52.Final.jar;D:/IDEA2020/lib/protobuf-java-3.13.0.jar;D:/IDEA2020/lib/maven-repository-metadata-3.6.1.jar;D:/IDEA2020/lib/idea_rt.jar;D:/IDEA2020/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar;D:/IDEA2020/lib/commons-lang3-3.10.jar;D:/IDEA2020/lib/trove4j.jar;D:/IDEA2020/plugins/java/lib/jps-javac-extension-1.jar;D:/IDEA2020/lib/plexus-utils-3.2.0.jar;D:/IDEA2020/lib/util.jar;D:/IDEA2020/lib/nanoxml-2.2.3.jar;D:/IDEA2020/lib/maven-resolver-api-1.3.3.jar;D:/IDEA2020/lib/log4j.jar;D:/IDEA2020/plugins/java/lib/javac2.jar;D:/IDEA2020/lib/intellij-deps-fastutil-8.4.1-4.jar;D

-l 用于输出main函数的完整路径

C:\Users\shj>jps -m -l
19080 sun.tools.jps.Jps -m -l
41064
42040 com.example.juc.JucApplication
37804 org.jetbrains.jps.cmdline.Launcher D:/IDEA2020/lib/plexus-interpolation-1.25.jar;D:/IDEA2020/lib/netty-resolver-4.1.52.Final.jar;D:/IDEA2020/lib/lz4-java-1.7.1.jar;D:/IDEA2020/lib/plexus-component-annotations-1.7.1.jar;D:/IDEA2020/lib/platform-api.jar;D:/IDEA2020/lib/forms_rt.jar;D:/IDEA2020/lib/netty-codec-4.1.52.Final.jar;D:/IDEA2020/lib/oro-2.0.8.jar;D:/IDEA2020/lib/netty-buffer-4.1.52.Final.jar;D:/IDEA2020/lib/netty-transport-4.1.52.Final.jar;D:/IDEA2020/lib/protobuf-java-3.13.0.jar;D:/IDEA2020/lib/maven-repository-metadata-3.6.1.jar;D:/IDEA2020/lib/idea_rt.jar;D:/IDEA2020/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar;D:/IDEA2020/lib/commons-lang3-3.10.jar;D:/IDEA2020/lib/trove4j.jar;D:/IDEA2020/plugins/java/lib/jps-javac-extension-1.jar;D:/IDEA2020/lib/plexus-utils-3.2.0.jar;D:/IDEA2020/lib/util.jar;D:/IDEA2020/lib/nanoxml-2.2.3.jar;D:/IDEA2020/lib/maven-resolver-api-1.3.3.jar;D:/IDEA2020/lib/log4j.jar;D:/IDEA2020/plugins/java/lib/javac2.jar;D:/IDEA2020/lib/intellij-deps-fastutil-8.4.1-4.jar;D

-v 可以查看传递给jvm的参数

C:\Users\shj>jps -m -l -v
37272 sun.tools.jps.Jps -m -l -v -Denv.class.path=.;C:\Program Files\Java\jdk1.8.0_281\lib\dt.jar;C:\Program Files\Java\jdk1.8.0_281\lib\tools.jar; -Dapplication.home=C:\Program Files\Java\jdk1.8.0_281 -Xms8m

41064  exit -Xms128m -Xmx2020m -XX:ReservedCodeCacheSize=512m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -javaagent:C:\Users\Public\.jetbrains\jetbrains-agent-v3.2.1.c46b.ed7=by https://zhile.io -Djb.vmOptionsFile=C:\Users\shj\AppData\Roaming\JetBrains\IntelliJIdea2020.3\idea64.exe.vmoptions -Djava.library.path=D:\IDEA2020\jbr\\bin;D:\IDEA2020\jbr\\bin\server -Didea.jre.check=true -Dide.native.launcher=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IntelliJIdea2020.3 -XX:ErrorFile=C:\Users\shj\java_error_in_idea64_%p.log -XX:HeapDumpPath=C:\Users\shj\java_error_in_idea64.hprof

42040 com.example.juc.JucApplication -XX:TieredStopAtLevel=1 -Xverify:none -Dspring.output.ansi.enabled=always -javaagent:D:\IDEA2020\lib\idea_rt.jar=63835:D:\IDEA2020\bin -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8

37804 org.jetbrains.jps.cmdline.Launcher D:/IDEA2020/lib/plexus-interpolation-1.25.jar;D:/IDEA2020/lib/netty-resolver-4.1.52.Final.jar;D:/IDEA2020/lib/lz4-java-1.7.1.jar;D:/IDEA2020/lib/plexus-component-annotations-1.7.1.jar;D:/IDEA2020/lib/platform-api.jar;D:/IDEA2020/lib/forms_rt.jar;D:/IDEA2020/lib/netty-codec-4.1.52.Final.jar;D:/IDEA2020/lib/oro-2.0.8.jar;D:/IDEA2020/lib/netty-buffer-4.1.52.Final.jar;D:/IDEA2020/lib/netty-transport-4.1.52.Final.jar;D:/IDEA2020/lib/protobuf-java-3.13.0.jar;D:/IDEA2020/lib/maven-repository-metadata-3.6.1.jar;D:/IDEA2020/lib/idea_rt.jar;D:/IDEA2020/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar;D:/IDEA2020/lib/commons-lang3-3.10.jar;D:/IDEA2020/lib/trove4j.jar;D:/IDEA2020/plugins/java/lib/jps-javac-extension-1.jar;D:/IDEA2020/lib/plexus-utils-3.2.0.jar;D:/IDEA2020/lib/util.jar;D:/IDEA2020/lib/nanoxml-2.2.3.jar;D:/IDEA2020/lib/maven-resolver-api-1.3.3.jar;D:/IDEA2020/lib/log4j.jar;D:/IDEA2020/plugins/java/lib/javac2.jar;D:/IDEA2020/lib/intellij-deps-fastutil-8.4.1-4.jar;D -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs="" -Djdt.compiler.useSingleThread=true -Dpreload.project.path=D:/work/juc -Dpreload.config.path=C:/Users/shj/AppData/Roaming/JetBrains/IntelliJIdea2020.3/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Dio.netty.initialSeedUniquifier=-8542068102786334792 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2020.3 -Didea.home.path=D:\IDEA2020 -Didea.config.path=C:\Users\shj\AppData\Roaming\JetBrains\IntelliJIdea2020.3 -Didea.plugins.path=C:\Users\shj\AppData\Roaming\JetBrains\IntelliJIdea2020.3\plugins -Djps.log.dir=C:/Users/shj/AppData/Local/JetBrains/IntelliJIdea2020.3/log/build-log -Djps.fallback.jdk.home=D:/IDEA2020/jbr -Djps.fallback.jdk.version=11.0.10 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/shj/AppData/Local/JetBrai

你可能感兴趣的:(java,开发语言)