On the server (the remote location)
- Add the following jvm arguments to your run.sh script
- -Xdebug
- -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
- address=8000 can be configured to any available port on the server
- suspend=n means that the application will run normally, even after you connect to it. After connecting, you will be able to suspend threads or insert breakpoints just as you would expect with local debugging
- Bounce the application
On the client side (using Eclipse)
- From the main Eclipse context window (File, Edit, etc…) choose Run -> Debug Configurations
- Locate "Remote Java Application" in the left pane
- Right click and choose "New"
- Name your configuration something you will remember. This is what you will run.
- Under the "Project" section, browse your local workspace to find the source that corresponds to the remote application
- Under "Connection Type", choose "Standard (Socket Attach)"
- Fill in the "Host" and "Port" boxes with remote host and the port you specified in the "address=xxxx" section above
- Click Apply or Debug to save your configuration.
- To see active threads, launch your "Debug" view. In most standard installations, that view is a part of the Debug perspective.
- You can now suspend processes, place breakpoints, step through code, etc.
NOTE: When you are done, you probably want to right click the project in the "Debug" view and choose "Disconnect". If you choose "Terminate", or just use the red square like you probably normally do, you will kill the process out on the server.