Debugging in JBuilder
Please follow all steps when
working on lab 8 including the last step:
-
create a directory jdbproject
on your floppy disk (or as a subdirectory of a directory in which you want
to work)
-
create a subdirectory pastri
(pascal's triangle) for the project done in lab 8
-
create subdirectories src and
classes of pastri
-
choose Start -> Class -> cs
-> JBuilder3.5 -> JBuilder3.5
-
choose File -> New project
enter: A:\jdbproject\pastri\Pastri.jpr
-
choose Project -> Add to project
-> Add file
enter: A:\jdbproject\pastri\src\Pastri.java
select "yes", when asked
if the file should be created
-
double click on Pastri.java
in the left part of the JBuilder window
-
cut and paste code from the
lab into main part of window
-
select File -> Save All
-
copy ConsoleReader into A:\jdbproject\pastri\src\
-
select Run -> Run project
click "Set" button next
to "Main class"
select Pastri
-
select Run -> Step over to start
debugging
-
use Help -> Help topics
-
select Debugging Java programs
-
scroll down until you see a
table explaining the "Debugging Toolbar"
-
find out how to "Reset Program",
"Step over", "Step into", and "Add Watch"
-
to inspect a variable, right
click with the mouse and select Evaluate/Modify and enter the variable
name
-
to toggle a breakpoint click
on the grey area left of your code
-
to look at the variables set
by "Add Watch" click the glasses left of the output window above the debugging
toolbar at the bottom
-
At the
end of the session select File -> Close Project and click to save unsaved
files as desired. This is necessary to ensure that other students
won't be held up because JBuilder looks for a floppy disk and doesn't find
one!!