Tomcat jpda Eclipse

1. 修改%CATALINE_HOME%/bin下的文件catalina.bat
 找到 这段代码

 

 

if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_shmem
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=jdbconn
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
set JPDA_OPTS=-Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpd
a

 

修改红色部分,

set JPDA_TRANSPORT=dt_socket

set JPDA_ADDRESS=8787

说明:dt_shmem表示本机;dt_socket表示远程调试

2. 修改%CATALINE_HOME%/bin下的文件startup.bat

找到 这段代码

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

修改为

call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

3. eclipse 设置调试环境

在Eclipse中选择RunDebug,在弹出的对话框中右击Remote Java Application新建一个远程调试项。

在“Project”中选择要调试的项目,在“Host”中输入需要远程调试项目的IP,也就是tomcat所在的IP,在“Port”中输入设置的端口号,比如上面设置的8787,然后钩选“Allow termination of remote VM”,Connection Type不需要修改。点击Apply按钮,然后点击Debug按钮。开始调试。

Tomcat jpda Eclipse_第1张图片

 

你可能感兴趣的:(eclipse,tomcat,server,socket,cmd,application)