Tip 16: Navigate to Compile Errors
Sometimes you just want to see the big picture: Will this class compile or not? If not, where does
the bug start? Did I place the debugger breakpoint before or after that spot?
You can gather this type of information with one glance from the error stripe—even before you
have actually compiled the class. The error stripe is the area on the right side of the editor. It repre-
sents the whole file and also marks the current caret position ( ). Additional marks represent lines
with warnings (orange), errors (red), debugger breakpoints (pink), editor bookmarks (gray), and
highlighted occurrences (tan); see Figure 12.
The colored box at the top of the error stripe tells you immediately whether this class will compile
without warnings (green box), compile with warnings (orange box), or not compile at all (red
box). If the box is red, there will be red error marks in the error stripe. Clicking any mark will take
you directly to the appropriate line so that you can fix it.
When you run the project or compile classes, any compiler errors and warnings are displayed in
the Output window. Open the Output window by pressing Ctrl-4 (Mac: Command-4). Click into
the Output window and use the arrow keys to move the caret from one error to another: If the file
that contains the error is open, the Source Editor scrolls to the line containing the error. Instead of
using the arrow keys, you can also press F12 and Shift-F12 to jump to the next and previous error
in the file. The Output window renders lines with errors as hypertext links: Clicking a link will
also take you directly to the faulty line.
© 2009 Sun Microsystems. All rights reserved.
This publication is protected by copyright. Please see page 2 for more details.
™ IDE Tips & Tricks
by Ruth Kusterer