IntelliJ IDEA Debugger Runs Child Process

We have Java code that starts a new process using the following code: Runtime.getRuntime().exec(command); I would like to tell the debugger that it should follow the child process, as you can do with GDB as described here by issuing the set follow-fork-mode child command.

Is there something equivalent in IntelliJ IDEA Java debugger? If so, how to configure it?

thanks

0
source share
1 answer

Java does not provide an automated way to debug processes and their child processes. To enable debugging, you must start the child process using the JVM options. IDEA configuration Remote debugging will suggest the right use cases. After starting the process using the appropriate parameters, you can connect to it using IDEA with the Remote Debugging configuration.

Examples of parameters:

 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 

You can start with suspend=y to pause execution until you connect to the debugger.

+2
source

Source: https://habr.com/ru/post/947600/


All Articles