Logo Questions Linux Laravel Mysql Ubuntu Git Menu

How do I attach to a process in Eclipse?

I am working with a large Java program that uses a command line shell to run integration tests. How do I attach eclipse to that process? Do I have to run the process and then attach it? It would be great to attach it to the shell process before I run it.

like image 647
xarzu Avatar asked Mar 19 '23 17:03


1 Answers

When you start your integration tests, add the following arguments to Java.

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

The suspend=y will pause startup until you attach with the debugger. In Eclipse, go to Run => Debug Configurations. Create a new "Remote Java Application" configuration and specify localhost as the host and 8000 as the port.

like image 78
John R Avatar answered Mar 28 '23 19:03

John R