Friday, July 2, 2010

Getting Started with Java Debugger

In this article I'm gonna explain how to use Java Debugger with Eclipse and NetBeans.
1. Run the application in command line.
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8888 \
-jar whatever.jar
The suspend=y means that the application will be suspended until the debugger has been attached to it.
2. In Eclipse, click 'Debug Configuration' in the Debug icon. Go to 'Remote Java Application' and specify the project that we want to debug, the connection (Socket Attach), hostname, and port number.
In NetBeans, click on 'Attach Debugger' and specify the connection type (SocketAttach), hostname, and port number.

No comments:

Post a Comment