方法1、 
WIN系统,在catalina.bat里: 
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8899 


Linux系统,在catalina.sh里: 
CATALINA_OPTS="-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8899" 


方法2、 


Win系统 
在tomcat目录下的bin目录中新建debug.bat,编辑内容如下 
set JPDA_ADDRESS=8000 
set JPAD_TRANSPORT=dt_socket 
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8899 
startup 


双击debug.bat 


Linux 系统 
startup.sh 中的第一行添加

declare -x CATALINA_OPTS="-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"