原文地址:http://blog.csdn.net/lishengc/article/details/6615826
eclipse远程调试两种模式:
一、服务端监听(1)服务器端需执行程序前加参数 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 说明:server=y 是指目标应用程序作为服务监听将要连接的远程调试器(常用); suspend=y 是指目标VM将暂停,直到调试器应用程序进行连接(若需要调试启动错误,很有用); suspend=n 是指目标VM不暂停; address=8000 监听端口。(2)运行服务端程序,程序将暂停(3)eclipse ==> Debug Configurations ==> Remote java application 新建测试工程(4)选择工程 ==> 模式 Socket Attach ==> 调试服务器IP ==> 调试端口(这里假设8000)(5)运行debug二、调试端监听(不常用)(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)运行服务端程序
转自:http://hi.baidu.com/sohochaser/blog/item/250ea38be7923c659e2fb40a.html 参考资料:http://www.ibm.com/developerworks/cn/opensource/os-eclipse-javadebug/jpda.bat的完整内容列在下面,其中黑体部分,在startup.bat基础上添加的代码:
@echo offif "%OS%" == "Windows_NT" setlocalrem ---------------------------------------------------------------------------rem Jpda script for the CATALINA Serverremrem $Id: jpda.bat 302918 2004-05-27 18:25:11Z yoavs $rem ---------------------------------------------------------------------------rem Guess CATALINA_HOME if not definedset CURRENT_DIR=%cd%if not "%CATALINA_HOME%" == "" goto gotHomeset CATALINA_HOME=%CURRENT_DIR%if exist "%CATALINA_HOME%/bin/catalina.bat" goto okHomecd ..set CATALINA_HOME=%cd%cd %CURRENT_DIR%:gotHomeif exist "%CATALINA_HOME%/bin/catalina.bat" goto okHomeecho The CATALINA_HOME environment variable is not defined correctlyecho This environment variable is needed to run this PRogramgoto end:okHomeset EXECUTABLE=%CATALINA_HOME%/bin/catalina.batrem Check that target executable existsif exist "%EXECUTABLE%" goto okExececho Cannot find %EXECUTABLE%echo This file is needed to run this programgoto end:okExecrem Get remaining unshifted command line arguments and save them in theset CMD_LINE_ARGS=:setArgsif ""%1""=="""" goto doneSetArgsset CMD_LINE_ARGS=%CMD_LINE_ARGS% %1shiftgoto setArgs:doneSetArgsset JPDA_TRANSPORT=dt_socketset JPDA_ADDRESS=8000set JPDA_SUSPEND=y call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
新闻热点
疑难解答