SE450: Java Tools: jdb [37/41] ![]() ![]() ![]() |
jdb is the java debugger. It is very useful if you are trying to
solve a difficult debugging problem, and using System.out.println()
is not effective (or you don't want to insert the new statements and recompile).
Usually, graphical debuggers are part of an advanced IDE, but the command line version works very well. You just need to know how to run through the code.
Here is an example session with Hello, just type in help after starting jdb to see all the options.
D:\school\se450\fall02\source\code\example>jdb Hello Initializing jdb ... > stop in Hello.main(String[]) Deferring breakpoint Hello.main(String[]). It will be set after the class is loaded. > run run Hello > main[1] step > Step completed: "thread=main", Hello.main(), line=7 bci=0 7 System.out.println("Hello from Venus!"); main[1] list 3 * A Java application that prints the message: "Hello from Venus!" 4 */ 5 public class Hello { 6 public static void main (String[] args) { 7 => System.out.println("Hello from Venus!"); 8 /* System.out refers to the standard output */ 9 } 10 } main[1] next Hello from Venus! > Step completed: "thread=main", Hello.main(), line=9 bci=8 9 } main[1] cont > The application exited