View the related commands of Java processes and threads under Windows and Linux systems

Windows command:

tasklist | findstr java  //Windows命令查看
taskkill /F /PID 11111		//杀死

Linux command:

ps -fe | grep java  //查看所有的Java进程
kill pid  //杀死对应pid的进程
top  查看所有Linux系统当前运行的进程,动态
top -H -p pid  //查看当前进程中线程的运行动态信息

JVM command (recommended):

jps  //查看进程
jstack pid  //查看进程中这一时刻的所有线程运行状态详情

The Java process corresponding to jconsole and jvisualvm remote connection:
First, when we start a Java script on Linux, we need the following command:

java -Djava.rmi.server.hostname=`ip地址` -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=`连接端口` -Dcom.sun.management.jmxremote.ssl=是否安全连接 -Dcom.sun.management.jmxremote.authenticate=是否认证 java类
实例:
java -Djava.rmi.server.hostname=192.168.0.107 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false Test1

After starting the Java program with this command, you can use the tool to remotely connect and monitor the Java process.
How to use the tool to connect, please refer to my previous article
https://blog.csdn.net/Brave_heart4pzj/article/details/109900114 The
fourth step is the connection step
. The connection method of jconsole is almost the same.
Insert picture description here
Note:
If the connection fails, it may be you The Linux firewall is not turned off.

Guess you like

Origin blog.csdn.net/Brave_heart4pzj/article/details/113095694