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.

Delete files locked by Windows

Windows loves to lock files that are in use, and not let you delete them. It's one of the most annoying things about Windows, especially when you are trying to say, move a downloaded AVI movie file. There is, however, a registry key you can tweak to change this; you have to delete this key: