Wednesday, October 14, 2009

Remote Debugging Java Applications

This is a quick post to show how you can connect to a remote Java virtual machine for debugging. I'm always forgetting the properties!

1. Add JVM Properties
Add the following properties to your java process before starting it up. This will tell it to accept debug connections.

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4001,suspend=y
2. Connect to Remote JVM through Eclipse
  • Go to your Eclipse Debug Configurations and create a new Remote Java Application configuration.
  • In Connection Type, choose Standard (Socket Attach).
  • Set the host to the machine where your Java application is running.
  • Set the port to the debug port specified in the JVM properties e.g. 4001.
  • Press Debug to start debugging.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.