When I first join this new company as my 2nd job, I was quite amazed by the fact that they are still using System.out.println to debug an application. Wait! There is nothing wrong using the sysout to debug application, but why not move to something faster, more efficient way? What if the developer forgot the remove the sysout line from their application? Wouldn’t it be messy and time consuming?
Having to set up my own machine to develop application using apache-tomcat-6.0.10, Java 1.5 and Eclipse 3.1.1, I took the opportunity to setup the environment so that I could use remote debugging, which enable easier and faster steps when fixing bugs.
Below are the steps to configure your machine for remote debugging.
Please note that the configuration is only tested for Win XP.
(1) Configure the catalina.bat file in apache-tomcat.

-You can find the catalina.bat file in your apache-tomcat installation folder/bin. Example, in my case, it would be D:/apache-tomcat-6.0.10/bin
-Edit the file using notepad and go to the line<set JPDA_TRANSPORT>. Set it to <set JPDA_TRANSPORT=”dt_socket”>
-And also set the port to 8000 <set JPDA_ADDRESS=”8000″>
-You can always set the JPDA_ADDRESS to another port. Just make sure that the port number is not in used. To check,hit START=> RUN => type cmd => type netstat.
All running ports will be displayed.
(2) Configure remote debugging in Eclipse.
-Click on the green beatle icon on top of the tools, you’ll be able to see this pop up.

-At Remote Java Application, click new and configure the settings.
-Type localhost at Host and 8000 as the port. Please note that the port must be the same with the JPDA_ADDRESS in catalina.bat file.
-Browse the application that you would like to debug.
(3) Start your server.

-To start the server, just type catalina jpda start

-Once started, you’ll be able to see the dt_socket on your console.

-You can also check whether the port has been started using the netstat command.
(4) Start remote debugging, Place a line break.
-Go to step (2). Click on DEBUG.

-Go to the method that you would like to debug.
-Double click on the left panel. You’ll be able to see a line break with a tick symbol.
(5) Debug
-Once your application hit the method, the eclipse will enable debugging. It’ll stop at the line break (which you had define earlier).
-Switch to Debug view.

-Hit F6 to go thru the codes.

(6) Stop debug mode
-To stop the debug mode, just click on the disconnect button.


(7) Stop server
-To stop the server, just type catalina stop

Seems tidious? But its not as hard as you think. Once you have your hands on it, you’ll be amazed what this Eclipse has offered!