How to Debug with JDB
Index
JDB Debugging features under Kawa are restricted to JDB features only. Please follow these steps to JDB debug under Kawa. The sample program explained here is the DrawTest demo program that is shipped with JDK.
- Create a new project DrawTest under the DrawTest directory of JDK.
- Add Drawtest java file to the project and set the compiler options for the project to have debug information
- Compile Drawtest file to make Drawtest class. Move the cursor to line 96 as shown in the figure below and press F9 to insert a breakpoint on that line. Breakpoints are indicated by a red circle next to the line

- Start the Debugger by pressing F5 or selecting Build/JDB Debug.
- Click left button anywhere in the drawtest program and the breakpoint is hit immediately as the breakpoint is set for mouse down event. At this time you can single step(F8) or step over(F12) or step up(F11) or continue(F5) or check any variable value by double clicking on the variable in the editor window. In the figure shown above, the current line in the debugger is indicated by a green arrow and the value of variable x1 is shown to be 64 as seen in the debug output window.
- Any JDB command can be passed to the debugger by typing the command in the commands in the output window and pressing enter to submit the command. Please
select View/Debug Toolbar to display the debug toolbar.
- Pressing F10 or quitting the drawtest program will exit the debugger. If the Java source files are installed and the directory options is setup properly under
Customize/Directories then during single stepping the source files are opened to indicate the current line. In order for Kawa to open your package source files it is important to add the package class files to the package hierarchy and add the source path without the package name to package source path under Customize/Directories for Kawa to be able to find the source files.