Accepted answer

can you check if this works?

jpda_opts="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n" jpda start


for apache-tomcat-8.5.28

modify jdpa_opts like the below then run like catalina.bat jpda start



modifying the startup.bat with the catalina_opts and jpda_opts didn't work for me but adding them to catalina.bat did

  1. modify catalina.bat

catalina_opts="-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"


  1. modify startup.bat to include jpda

change call "%executable%" start %cmd_line_args% to

call "%executable%" jpda start %cmd_line_args%

then configure remote java application in your debug configurations in eclipse.


first of all, if you open catalina.bat with text editor, you see that: "do not set the variables in this script....." so never change it in that script, instead you can do below steps:

  1. it advices you to create a new bat file with name "setenv.bat".
  2. then set 2 variables in that bat file such as:

    set catalina_opts="-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

    set jpda_opts="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

  3. lastly run that at cmd that: "catalina.bat jpda start"

  4. in ide, create remote debug configuration and set host to related server ip and port to 8000.


see this answer for issues i had with java 8 and tomcat 9: java remote debugging (jpda) not working for me in tomcat 9

this is similar to @dab's warning, and his solution is likely more secure.


for apache-tomcat-8.5.28 version just do this,

catalina.bat jpda start

as the default settings already configured for us in catalina.bat as

if not "%jpda_opts%" == "" goto gotjpdaopts set jpda_opts=-agentlib:jdwp=transport=%jpda_transport%,address=%jpda_address%,server=y,suspend=%jpda_suspend%

so no need of any other config. and when you execute command catalina.bat jpda start, you can see debug port 8000 is opened.


i was hitting this issue while running tomcat inside of a docker container. to fix this make sure you add the '-p 8000:8000' argument in your docker run command to expose this port to your local machine. you will of course need the file in your ${catalina_home}/bin/ within your container as well.


if still all the above doen't work you can always add to the script

    set "java_opts=-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"


in tomcat 7, has this code:

if [ "$1" = "jpda" ] ; then
  if [ -z "$jpda_transport" ]; then
  if [ -z "$jpda_address" ]; then
  if [ -z "$jpda_suspend" ]; then
  if [ -z "$jpda_opts" ]; then
  catalina_opts="$catalina_opts $jpda_opts"

ii implies that you can setup jpda with:

export jpda_transport=dt_socket
export jpda_address=8000
export jpda_suspend=n

or with:


and finally use: jpda start



modify catalina.bat to add

set jpda_opts="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n" 


catalina_opts=-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

optional: add below line to run the debug mode by default when you run startup.bat

call "%executable%" jpda start %cmd_line_args%

eclipse or sts select debug configuration right click -> new

connection type -> standard socket attach
port -> 8000 (as given in the catalina_opts)
host -> localhost or ip address


just run ./ jpda start (forks) or ./ jpda run (does not fork, not mentioned in help). all options mentioned here default to sane values.


let me share the simple way to enable the remote debugging mode in tomcat7 with eclipse (windows).

step 1: open bin/startup.bat file
step 2: add the below lines for debugging with jdpa option (it should starting line of the file )

    set jpda_address=8000  
    set jpda_transport=dt_socket  

step 3: in the same file .. go to end of the file modify this line -

    call "%executable%" jpda start %cmd_line_args%  
    instead of line  
    call "%executable%" start %cmd_line_args%  

step 4: then just run bin>startup.bat (so now your tomcat server ran in remote mode with port 8000).

step 5: after that lets connect your source project by eclipse ide with remote client.

step6: in the eclipse ide go to "debug configuration"

step7:click "remote java application" and on that click "new"

step8. in the "connect" tab set the parameter value

   project= your source project  
   connection type: standard (socket attached)   
   host: localhost  

step9: click apply and debug.

so finally your eclipse remote client is connected with the running tomcat server (debug mode).

hope this approach might be help you.



many of the above answers are correct, but remember that by default the debugger will listen on localhost, which means you can debug only if you're running the debugging client (for example, the ide) on the same machine.

if you are debugging a remote server you will need to specify the correct ip address on that server to listen on, for example

jpda_opts="-agentlib:jdwp=transport=dt_socket,address=,server=y,suspend=n" jpda start

note that the address is now

of course, you can also check which ip is actually being used, by running

netstat -an

this command is valid on both windows and linux - you just need to filter out the port with find (windows) or grep (linux).


in catalina.bat file please modify the below.

  • step 1: catalina_opts="-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

  • step 2: jpda_opts="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

  • step 3: run tomcat from command prompt like below: jpda start

  • step 4: then in the eclipse create a debug configuration

    1. give any name for configuration.
    2. give the project name.
    3. give the connection type as standard(socket attach)
    4. host as localhost
    5. port as 8000( or any port number , but that should be same in other places also).


in the tomcat bin directory wherecatalina.bat or .sh is found (aka {catalina_base}/bin), edit (create if not there):


add the following line:

catalina_opts="-xdebug -xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

that's all you need to do, you don't need to edit the catalina.bat (or .sh) file.

see the comments in catalina.bator

you may have to adjust the syntax for your particular environment/situation. for example, if you already have catalina_opts defined, you might do something like this (in a windows environment):

set catalina_opts=%catalina_opts% -xdebug -xrunjdwp:transport=dt_socket,address=8088,server=y,suspend=n

to debug from eclipse:

run->debug configurations...->remote java application->new

and specify a name, the project you are debugging, and the tomcat host and debug port specified above.


i spent some time on this to get the right information.

so here is the detailed information step by step.

environment : windows 7

tomcat version : 7.0

ide : eclipse

configurations to be added for enabling remote debugging with in tomcat is


i don't recommend above configuration fro non windows environment. to add the above configuration double click on tomcat server which will be available in server view. find the below screen shot. enter image description here

now add the above runtime environment configuration to tomcat. for this check below screenshot.

enter image description here

now got to arugments tab in edit launch configuration properties as show in below screen shot.

enter image description here

goto vm arguments section add these lines.



enter image description here

now got to debug button available on eclipse toolbar.

enter image description here

in debug configurations find "remote java application" and double click on it.enter image description here

in name field enter any name which you like to.

from project field using browse button select the project which you want to perform remote debug.

the hostname is nothing but the host address. here i'm working locally so it is "localhost".

last the port column the value should be 8000. apart from name and project text fields other two columns host and port will be filled by eclipse itself if not make you have same values as mentioned. check screen shot for info.enter image description here

now right click on tomcatserver in server console select add and remove from context menu. from this dialog you can add the project to server.

now run the tomcat sever.

enter image description here

now run the tomcatdebugconfiguration from debug tool.

last open internal or external browser and run your project. if the execution control reached the break points then the eclipse will prompt for debug perspective.

Related Query

More Query from same tag