Firstly, jvm options :
-Xdebug : Enables debugging support in the VM
-Xrunjdwp:<options> : Loads in-process debugging libraries and specifies the kind of connection to be made (Xrunjdwp parameters)
I use -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
Secondly, debug the remote application :
- With Eclipse :
Go to Run -> Debug Configurations and create a new Remote Java Application.
Set the project you will debug in order to have source biding during debug and specify remote server connection configuration : host and debug port specified in -Xrunjdwp options.
Now, once your application is started, just click Debug and your IDE will be linked with the remote jvm.
- With jdb
Launch jdb (found in your JAVA_HOME/bin) with remote jvm connection parameters :
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000
If you want more informations on jdb, there is a great article by Herong Yang.
No comments:
Post a Comment