Wednesday, February 14, 2007

Remote debugger

I already knew that we can attach a debugger ( like Eclipse Debugger) to a remote JVM, as long as it's based on an application server ( J2EE like JBoss etc ).
I've learned today that, very easily, we can also debug a simple Java application ( J2SE) using the following arguments:

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

And here are the explanation of the arguments, as I found them in this jacoozi thinking solutions site


The jdb parameters specify the way debugger will operate. For instance transport=dt_socket instructs the JVM that the debugger connections will be made through a socket while the address=1044 parameter informs it that the port number will be 1044. Similarly, if you substitute suspend=y, the JVM starts in suspended mode and stays suspended until a debugger is attached to it. This may be helpful if you want to start debugging as soon as the JVM starts.


For the Eclipse Remote Debugger option, you can have a glimpse here or here.

No comments: