General discussion


Maximize your jdb debugging sessions

By MaryWeilage Editor ·
This week's Java newsletter explains how you can jdb to debug without your debugger. The author also demonstrates how you can maximize your jdb debugging sessions.

Is this tip useful to you? Do you know of another method for debugging without a debugger? Please let us know.

If you aren't subscribed to the free Java newsletter, click the following link to automatically sign up:

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Use remote debugging instead of jdb

by s.stephens In reply to Maximize your jdb debuggi ...

Java supports a very easy to use remote debug capability. This is best explained on pg 136 of

The Java Developers Guide to Eclipse

by Shavor, et al; Addison Wesley, 2003.

I have a Linux script to start the target VM:

java -ea -cp $CLASSPATH -Xdebug -Xnoagent\ -Xrunjdwp:transport=dt_socket,server=y,\
suspend=y,address=8000 -Djava.compiler=NONE\
$1 $2 $3 $4

The first argument ($1) is the class to be debugged. The others are arguments to the main method.

This works on the localhost or across a TCP/IP connection.

I have used this technique on Eclipse. Others have told me that they have used it on NetBeans. On Eclipse, create a remote debug configuration:

Run>Debug..>Remote Java Application>New

Specify a configuration name, select the project, (You don't need to specify the
the class, Eclipse seems to determine the class by itself.)

Specify the host and socket (must be the same as socket number in the java command line or linux script).

Run the java command to start the VM. The VM will wait for a connection.

Set a break point and start the Eclipse debugger.

Find the problem.

Fix the problem. Some VMs allow hot code swap. If the one that you are using does, you don't even need to be rebuild, but make sure that the changes are committed into your source code management system, if desired.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums