Java Reference
In-Depth Information
To debug scripts, you need to add breakpoints using one of the following three
methods:
Place the cursor in the line where you want to set/unset the
breakpoint. Right click and select the menu item Toggle Line
Breakpoint to set and unset the breakpoint.
Place the cursor in the line where you want to set/unset the
breakpoint and press Ctrl + F8 . Pressing this key combination
for the first time sets the breakpoint. If the breakpoint is already
set, pressing the same key combination unsets the breakpoint.
debugger statement in the script. The debugger
statement acts like a breakpoint when a debugging session is
active. Otherwise, it has no effect.
Add the
Figure 13-2 shows the same script with two breakpoints at lines 21 and 26.
Figure 13-2. A Nashorn script opened in the NetBeans IDE that has two breakpoints
Now you are ready to debug the script. Right click in the script pane and select the
Debug File menu item. Alternatively, press Ctrl + Shift + F5 when the script pane is
active. It will start the debugging session as shown in Figure 13-3 . The debugger stops at
the first breakpoint, as shown in the figure. At the bottom, you see the Variables pane
open that shows all the variables with their values in scope. If you want to view other
details of the debugging session, use one of the menu items under the main menu
Window Debugging . If you close any debugging panes such as the Variables pane,
you can reopen them using the Window Debugging menu.
Search WWH ::




Custom Search