1.单击Run—》选择Debug Configurations—》在弹出的Debug Configurations窗口中点击左边的Remote Java Application下面的项目名称。
2.在下图右边的窗口输入项目地址和端口号。
3.勾选最下面的选项,点击Debug按钮,弹出框提示:Failed to connect to remote VM because of unknown hostFailed to connect to remote VM because of unknown hostFailed to connect to remote VM because of unknown hostFailed to connect to remote VM because of unknown host。
后来在网上查了下资料,发现是apache服务器里面的配置文件改了就可以了, 把tomcat/bin/catalina.bat配置文件里的set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
后面加上
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
注意的地方是:8000这个端口可以自己随便设置,但是必须和上面Eclipse Debug设置的端口一样才可以!