Java 7 for Absolute Beginners

(nextflipdebug5) #1
CHAPTER 11 ■ DEBUGGING WITH ECLIPSE


  • Line breakpoints

  • Exception breakpoints

  • Classloading breakpoints

  • Watchpoints

  • Method breakpoints

  • Printpoints


I'm going to cover only line breakpoints, as they will solve nearly all the problems you are likely to
encounter—I made it a long way into my career before I ever needed anything other than a line
breakpoint. However, I encourage you to investigate the other kinds of breakpoints on your own. Start
by reading the Eclipse help file's content about breakpoints.


Setting a Line Breakpoint


To set a line breakpoint:



  1. Right-click in the thin area to the left of the line of code where you want to set a
    breakpoint.

  2. Choose TToggle Breakpoint. A breakpoint appears at the line where you right-
    clicked, as shown in Figure 11-3. The blue dot to the far left of the first line in
    the draw method is the breakpoint indicator. When your program runs, it
    stops at that point and shows you the values of all the objects and primitives
    that are in scope at the time.


Figure 11-3. Breakpoint in code:
Free download pdf