Custom CSS

Tuesday, April 17, 2007

Remote debugging with Tomcat or any Java application

This should have been posted a while back, but you can attach a debugger to any running application if you set your runtime opts the right way:

set JAVA_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE \
 -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 \
 -Xmx32m -Xmx128m -XX:MaxPermSize=1024m

I do this for Tomcat; I add that line into my and attach Eclipse's debugger to my running instance of Tomcat. This way I can break my webapp, make some code changes, and see them reflected immediately, without restarting the app server. It's extremely convenient to be able to live in the debugger.
Post a Comment