eclipse远程调试两种模式:服务器
1、服务端监听eclipse
(1)服务器端需执行程序前加参数 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000socket
说明:server=y 是指目标应用程序做为服务监听将要链接的远程调试器(经常使用);测试
suspend=y 是指目标VM将暂停,直到调试器应用程序进行链接(若须要调试启动错误,颇有用);debug
suspend=n 是指目标VM不暂停;调试
address=8000 监听端口。server
(2)运行服务端程序,程序将暂停ip
(3)eclipse ==> Debug Configurations ==> Remote Java Application 新建测试工程rem
(4)选择工程 ==> 模式 Socket Attach ==> 调试服务器IP ==> 调试端口(这里假设8000)it
(5)运行debug
2、调试端监听(不经常使用)
(1)eclipse ==> Debug Configurations ==> Remote Java Application 新建测试工程
(2)选择工程 ==> 模式 Socket Listen ==> 调试监听端口(这里假设8000) ==> Allow termination of remote VM 打勾
(3)运行debug,程序将暂停,左上显示 Waiting for vm to connect at port 8000...
(4)服务器端需执行程序前加参数 -Xdebug -Xrunjdwp:transport=dt_socket,address=172.16.7.34:8000
说明:address=172.16.7.34:8000 发送链接的地址和端口。
(5)运行服务端程序