今日在tomcat下开发,为避免在没有改变java方法和类名的情况下重新加载整个webapp,查阅了些资料后需要启用jvm的jpda, 同时要能远程debug;
研究了半天发现其实很简单,人家已经做的很好了;只需要加jpda 4个字母就可以了;
修改startup.bat 找到call "%EXECUTABLE%" start %CMD_LINE_ARGS% 改为call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS% 即可;这样在java的方法里面修改代码就不需要费时费力的重新加载上下文,也不需要重新登录。
如果需要修改debug端口,(默认8000),改catalina.bat 中set JPDA_ADDRESS=8000 处;
启动命令方式如下:
echo Usage: catalina ( commands ... )
echo commands:
echo debug Start Catalina in a debugger
echo debug -security Debug Catalina with a security manager
echo jpda start Start Catalina under JPDA debugger
echo run Start Catalina in the current window
echo run -security Start in the current window with security manager
echo start Start Catalina in a separate window
echo start -security Start in a separate window with security manager
echo stop Stop Catalina
echo version What version of tomcat are you running?