Search code examples
javaspringdebuggingintellij-idearemote-debugging

Debug remote java application using Intellij


I am trying to debug remote java application in Intellij but unable to get sucess, The steps which I am doing is

Run>Edit Configuration> Defaults> Remote

enter image description here

What is/are I am missing?


Solution

  • First, create a new Remote debugging configuration:

    ALT + U + R

    Take note of the port which IntelliJ plans to listen in Tomcat. On my setup the port is 8000, which is the default and this should be fine for your setup as well. To change the Tomcat JPDA port, edit catalina.bat (or whatever your startup script is) and find a line which looks like the following:

    set JPDA_ADDRESS=8000
    

    Second, make sure that you are building your project with javac -g .... The -g option means that debugging information will be turned on in your Spring WAR.

    Finally, when you start Tomcat, use catalina jpda start, which will tell Tomcat to connect the debugger to port 8000. When you want to connect to IntelliJ then use ALT + SHIFT + F9 and select your remote configuration from the menu. Of course, you should add some breakpoints, without which it doesn't make much sense to be in debug mode.