Add a command line parameter to the child process as follows:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9999
(you can use a different port number than 9999, it is up to you, but it is best to choose a number above 1024)
Then, in Eclipse, create a debug configuration such as "Remote Java Application". Set the host as localhost and the port is 9999.
There is a lot of additional information in this developerWorks article.
EDIT: By the way, for more flexibility when specifying the command line and environment of your child process, use the java.lang.ProcessBuilder class instead of Runtime.exec(...) .
source share