在Tomcat下新建
setenv.sh
文件运行
chmod 755 setenv.sh
将下面的代码添加到
setenv.sh
文件中1
2export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=1043,server=y,suspend=n"
Intellij Run/Debug Configurations下新建Tomcat Server Remote
![Screen Shot 2017-12-02 at 13.53.42](http://static.w2x.me/2017-12-02-Screen Shot 2017-12-02 at 13.53.42.png)在新建的页面先择
Starup/Connection
标签,然后选择Debug选项
![Screen Shot 2017-12-02 at 13.56.20](http://static.w2x.me/2017-12-02-Screen Shot 2017-12-02 at 13.56.20.png)将
Port
的值修改为1043
![Screen Shot 2017-12-02 at 13.58.42](http://static.w2x.me/2017-12-02-Screen Shot 2017-12-02 at 13.58.42.png)Tomcat启动后,Intellij即可远程Debug