Izza
Izza

Reputation: 2419

Remote Debugging with Intellij Idea

I came to know of the remote debugging procedure under Idea recently. What I do is copy the configuration of remote debug under Run | Debug Configuration in Idea to the command line java execution parameters. The actual command line parameters are:

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

If it is a script, I add these commands to it. By doing so, the command line displays the message:

Listening for transport dt_socket at address: 8000

So the debugging can happen using the local source code. However, I don't properly understand how remote debugging work. Anyone who knows how remote debugging actually works, please give me an explanation.

Thank you!

Upvotes: 6

Views: 22491

Answers (3)

Ashish Yadav
Ashish Yadav

Reputation: 111

Consider a scenario where you want to fix something in your application but your application only can run over a server machine because of other dependencies. That is where Remote Debugging come into picture. You Just connect the sever by providing the hostname and port and connect it with your respective environment.

How It works:

  1. Application to be debugged will attach a socket to itself and then will start listening debug instructions.
  2. Debugger will bind itself to that socket and then send instructions.

Upvotes: 3

BSrinivas
BSrinivas

Reputation: 116

This is best way to test your code which are in different environment .

we need to have below points for sure before you are using remote debug .

  1. we are using JBOSS in our servers.
  2. configure - JBOSS_HOME/bin/run.conf JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

  3. now add the server IP and port number into the intellij remote debugging . 4.your should have the latest version of the project in local that is in synch with the server else debug will not be allowed.

  4. you need to start the intellij server for the project .
  5. Then start the remote debug .
  6. place a debug point in local and when we start testing in the server , when it hits the debug point it will stop and wait untill you process it .

The other point is , it will hold all the request in the queue and will not allow anyone to go through the break point which may stop other users to test it .

Upvotes: 0

CrazyCoder
CrazyCoder

Reputation: 401877

Remote debugging means that you can run your Java code anywhere, either on the local or remote machine. When it's running in the debug mode, you can connect to it from the IDE using TCP network connection and perform debugging. IDE needs to have the source code for the running classes so that you can place breakpoints inside this code and perform stepping, inspecting variables, etc.

If you are interested in technical details, refer to the JPDA documentation.

Upvotes: 10

Related Questions