Jdwp options in Debug Mode


when i run my program in debug mode, the comand line jdwp protocol param (server) was set to n(like below), can this be set to y?

\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=,suspend=y,server=n

version: IntelliJ IDEA 2023.2.2 (Ultimate Edition)

appreciated for your reply!


It can be set to y, see: https://www.jetbrains.com/help/idea/tutorial-remote-debug.html#debugger_rc

set to n as it will act as a debugger client.

Some explanation:

To debug an application remotely, you will have to set options like: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4242. This allows remote debuggers (jdb even ships with JDK) to attach to a running Java process.

There are two flavors of transports: dt_socket and dt_shmem. The dt_shmem option only works in case both processes are running on the same platform and is only available on Windows.

With suspend=y the Java-process will wait until the debugger connects, with suspend=n you will be also able to debug the application servers startup process.

The option server=y opens a socket and listens for incoming debugger requests. With server=n the debugged application will try to connect actively to a debugger and run therefore as a client.

So there is no black magic involved in debugging application servers. As long they are implemented in Java, you will be always able to debug them. Even without any fancy tools.

See "official" list of all available remote debugging options: http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/conninv.html



thans for your anwser!

refer to the toturial:https://www.jetbrains.com/help/idea/tutorial-remote-debug.html#debugger_rc, i add vm options: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005, then i can connect to the debug server using jdb tool.

however, it seems that it's only worked when i click the run button to run my program. when i click the debug run button to run my program, the options added seems to be overridden, is this correct?


When you click the debug button in IDE, it assumes you are using IDEA's local debug function.

As described here: https://www.jetbrains.com/help/idea/2023.2/debugging-code.html


There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from IntelliJ IDEA. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.


Please sign in to leave a comment.