1、在windows下载arthas我是在c盘下面新建了一个Arthas将其下载到“C:\Program Files\Arthas”路径下。Invoke-WebRequest-Uri https://arthas.aliyun.com/arthas-boot.jar-OutFile arthas-boot.jar2、启动并解决报错PS C:\Program Files\Arthasjava-jararthas-boot.jar[INFO]JAVA_HOME: C:\Program Files\Java\jdk-21.0.12[INFO]arthas-boot version:4.3.5[ERROR]Cannotfindjavaprocess. Try to runjpsorjcmdcommands to list the instrumented Java HotSpot VMs on the target system. Pleaseselectan available pid. PS C:\Program Files\Arthas是因为我有jdk两套环境我设置的JAVA_HOME是jdk8的改成21的后使用jps -l命令就能看到自己启动的项目pid了,再次使用 java -jar arthas-boot.jar 重试就可以了。3、使用arthas把自己的项目跑起来后在启动arthas,java-jar arthas-boot.jar自己的项目和arthas都启动起来后arthas会监控到当前所有启动的java项目输入自己的java项目前面对应的数字。我提前写了一个测试接口让线程睡了3s后执行。http://localhost:8080/test4、trace先在arthas的控制台执行追踪test这个方法trace 全类名 方法名 trace com.cao.controller.TestControllertest执行完成后再去调用http://localhost:8080/test 接口触发test方法被调用这个时候会被arthas追踪到查看耗时