How do I setup remote debugging for Tomcat 5.0 started as a service?

Abstract: How do I setup remote debugging for Tomcat 5.0 started as a service?

Issue:

I want to configure Tomcat 5.0 for remote debugging, but I do not use the Tomcat startup script, but instead start Tomcat as a service. How can the service be configured for remote debugging?

Solution:

Use the taskbar control panel for Tomcat to open the 'Apache Tomcat Properties' dialog (right-click | Configure...). Under the Java tab, in the 'Java classpath' field, make sure that the path to the JDK/lib/tools.jar is listed. Next, add the following parameters, each on a single line under the 'Java options' list box (make sure there are no trailing or leading whitespaces):

-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n

Once you have completed the above steps, just restart the Tomcat service and remote debugging will be enabled.