Tuesday, August 12, 2008

Remote debugging applications running from Eclipse with IntelliJ

I'm not an advocate for using Eclipse or any of it's relatives (IBM RAD). But on some projects, I can't avoid having to use it because the project only works on in Eclipse.
As often as I can, I will try to use IntelliJ because of its superior user interface. But when the code can't run from IntelliJ, I've set up a quick tutorial to setting up cross IDE debugging.

In Eclipse:
Right click on the code to run to get context menu --> Run as --> Run
In "Run" Dialog, create new or choose existing profile --> Arguments --> VM Arguments = -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 --> Run

The application will now start and wait for the debugger. The console will say "Listening for transport dt_socket at address:5005"

In IntelliJ:
Menu Item "Run" --> "Edit Configurations" to open the "Run/Debug Configurations" dialog
Add new configuration (+ button) --> Remote --> Choose name for configuration --> ok
Enter appropriate breakpoints and start the debugger with the configuration and the console will say "Connected to the target VM, address: 'localhost:5005', transport:' 'socket'.
IntelliJ debugging bliss.

1 comment:

  1. thanks mate, this helped me out :)

    I was wondering how in the world do I tell intelliJ's debugger to connect to a VM, now I found it.


Spam will be pruned