IDEA远程Debug调试程序
1.IDEA里边开发一个app程序
没什么写的,画个小心心.

maven打包可执行的jar
maven package

1. 上传jar到远程服务器并启动
1.1 win远程上传jar到远程服务器
scp IDEADebug-1.0-SNAPSHOT.jar root@node01:/opt/

1.2 配置远程应用以支持调试:
在远程服务器上启动应用程序时,需要添加特定的 JVM 参数来启用调试模式并监听指定端口上的调试连接。
nohup java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8089 -jar IDEADebug-1.0-SNAPSHOT.jar &
这里 suspend=n 表示不挂起应用直到调试器连接,address=8089 指定监听所有接口的8089端口。
2. 在IDEA中配置远程调试配置
创建远程调试配置,
Run
按钮旁边有个Edit Configurations

点击
+
添加新的配置,选择Remote JVM Debug
类型。

配置名称,并在 Port 字段输入远程应用监听的端口号,可以选择是否 Suspend on start,如果选中,则会在程序启动时暂停等待调试器连接。注意:jdk版本不一样启动参数有所区别

3. 连接到远程调试会话
开始调试会话:

4. 调试远程应用
使用断点、单步执行、查看变量值等功能: 在代码中设置断点,IDEA 会在这些位置暂停执行
5. 结束调试会话
停止调试:

往期推荐
DataX二次开发之达梦数据库插件
听说最近都在研究国产数据库?