I recently needed to setup a new development environment for myself, to setup the ability to debug the code I had to workout how to setup Eclipse to remotely connect to Tomcat. This is a question I had been asked before so thought I would document the process. This is for a Windows environment.

Tomcat

In tomcat/bin edit the Catalina.bat. Find the line

“set JPDA=”

and change it to

set JPDA=start
set JPDA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

Now start and you will get the message

Listening for transport dt_socket at address: 8000

Eclipse

Now you need to setup Eclipse to connect to this port.

Go to the OpenDebug Dialog:

OpenDebug dialog

Right click Remote Java Application and click on New.

Remote Java Application

You should not need to edit this page unless you are connecting to another machine in which case you need to change the Host name.

Host name

This connection will now appear under your debuggers. Click on this to connect.

Connect