条件
- 远程 Jar 包内容与本地 IDEA 中代码一致;
- IDEA 可以访问远程服务器;
步骤
配置IDEA
-
“Edit Configurations” - “+” - “Remote JVM Debug”
-
Host填入远程服务ip,port使用默认5005(被占用则换端口)。
-
复制 Command line arguments for remote JVM 中内容
|
|
记得在 Command line arguments for remote JVM 后点击选择 JDK 版本
重启远程服务
远程服务的启动命令改为(java后跟的是上面复制的内容)
|
|
断点调试
在IDEA中启动 remote 的 debug 调试。