1、打开配置页面
2、添加远程调试配置
3、进行参数配置
不同的jdk版本,配置的参数是不一样的!
其中Host为远程服务器的地址,Port为远程debug的端口,注意要与前面设置的address保持一致。
配置方式
apache-tomcat/bin/startup.sh开始处中增加如下内容:
#!/bin/sh# Better OS/400 detection: see Bugzilla 31132declare -x CATALINA_OPTS="-server -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:60001"os400=falsecase "`uname`" inOS400*) os400=true;;esac# resolve links - $0 may be a softlinkPRG="$0"while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`/"$link" fidonePRGDIR=`dirname "$PRG"`EXECUTABLE=catalina.sh# Check that target executable existsif $os400; then # -x will Only work on the os400 if the files are: # 1. owned by the user # 2. owned by the PRIMARY group of the user # this will not work if the user belongs in secondary groups evalelse if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then echo "Cannot find $PRGDIR/$EXECUTABLE" echo "The file is absent or does not have execute permission" echo "This file is needed to run this program" exit 1 fifiexec "$PRGDIR"/"$EXECUTABLE" start "$@"
如果是windows系统,在startup.bat开始处中增加如下内容:
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:60001
4、启动远程的tomcat
5、启动tomcat后,即可在IDEA中运行调试了,如下:
参考: