tomcat设置debug模式

1、设置

编辑catalina.bat,在

rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome

的上面插入以下内容

if ""%1"" == ""stop"" goto skip_config
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787

:skip_config

其中,suspend=n表示tomcat启动以后不会等待用户debug连接,suspend=y表示会等待。

保存 catalina.bat。

2、启动

 你可以手动启动startup.bat,这是及时生效的。也可以在eclipse里启动tomcat,如果不生效就先用startup.bat启动然后用eclipse调试一次,然后关闭tomcat,使用eclipse再次启动tomcat时,debug会自动打开。

原文地址:https://www.cnblogs.com/mabaishui/p/5476951.html