Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How do I edit catalina.bat to make remote debugging work ?

Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts,

After failing to use the normal debugging method to debug my web project which consists of jsp and servlet etc, I have decided to try remote debugging.

The thing is that I am not familiar with remote debugging.

I have tomcat v 9.0.4 x64 version for Windows 10 'embedded' inside Eclipse.

After doing some research on the internet, I realised I have to add in this line as per

ATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

However, when I open up my catalina.bat it has very strange 'language' such that I am not sure how to go about adding the said line.

Here's how my catalina.bat looks like :

I hope someone can tell me what should I do now in order to add in the line and anything I should be aware of in order to make my debugger works...

It's been 2 months already...I think will it take me forever or the things are forcing me to give up ...
Saloon Keeper
Posts: 6507
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not "strange language"; it's a Windows batch file. YOu probably don't need to change that at all, you just need to start it with "catalina.bat jpda start" instead of "catalina.bat start". I don't use the Eclipse integration, so can't say how that interacts, but I'd think that Eclipse has options to run Tomcat in debug (a.k.a. jpda) mode. If it doesn't, run Tomcat independently of Eclipse (which is what I advise anyway).
Saloon Keeper
Posts: 22248
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To reinforce what Tim Moores said, you don't have to change anything in the catalina.bat file. Just launch it with the "jpda start" command options.

You can override what port and other options JPDA will use by setting the appropriate environment variables, but usually you will not want to do that.

In Eclipse, create a Remote Debugging profile off the run/debug menu and set the target port and hostname to point to the instance of Tomcat running under JPDA. The default port is 8000.

Don't set any debugging options in the CATALINA_OPTS or setenv.bat (if you're using one). Everything you need is in the JPDA script options.

You have the option to start Tomcat in a paused state so that the debugger can connect before Tomcat starts (using the debugger resume command), or have Tomcat start normally and connect on the fly. Unless you need to debug stuff that's in initialization code, it's usually easier to leave it unpaused, but that's up to you.
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic