# Using the Debug Windows

The debug windows provide information about values and conditions in your code while you're running it in the debugger.

To view one of the debug windows, choose Debug Windows from the View menu, and select the desired window.

## The Locals Window

The Locals window automatically shows variables that are in scope as you execute your code in the debugger. You can modify the value of a primitive-type variable here while you are debugging.

You can expand entries for objects in the Locals window to view their members.

Some variable types have multiple views available in the Locals window. A small list of examples include:

- int: May be viewed and edited as a decimal integer or hexadecimal integer.
- char: May be viewed and edited as a character, Unicode escape, decimal integer, or hexadecimal integer.
- java.lang.StringBuffer: May be viewed showing just its contents as a String, its length, and its capacity, or with the default view showing its internal data structures.
- javax.servlet.http.HttpServletRequest: May be viewed showing attributes and other fields as simple name-value pairs, or with the default view showing its internal data structures.

To determine what other views are available and to switch to a different view, simply right-click on either the variable's name or value in the Locals window and look in the View As context menu. Note that the default view of internal data structures will be the only view available for some types.

## The Watch Window

You can use the Watch window to observe how the value of a particular variable changes as you're debugging. To set a watch, simply type the name of the variable into the Watch window.

Static classes must be fully qualified to be viewed in the Watch window.

## The Stream Window

The Stream Window is only active when doing JSP debugging and shows the output stream that the JSP is generating to send back to the Browser

## The Immediate Window

The Immediate window allows you to execute arbitrary code while debugging, with the following restrictions:

1. You cannot create new classes, Interfaces, or methods, or instantiate new object instances.
2. You cannot use the instanceof operator.
3. You cannot use .class syntax, such as Class c = java.lang.Object.class.
4. The value shown after clicking Evaluate will be the result of the last statement in the text field.
5. Static classes must be fully qualified.
6. If an object has a member variable and method with the same name, the variable is accessible but the method cannot be called.

## The Call Stack Window

The call stack shows the methods that have been called in order to reach the point at which execution is halted in the debugger. The methods are listed from most recently called to first called. You can also think in terms of each call being nested within the method below it on the call stack.

You can click on a method in the call stack to navigate to that method in Source View. This will also show the local variables available for that call stack, and reevaluate any watches within selected stack frame as well.

## The Threads Window

The Threads window shows information about the currently executing threads. You can click on stack frames to navigate to that method and refresh the Local and Watch windows in that stack frame. If you switch the selected thread and then use any of the step commands, you will step in that thread.

## The Breakpoints Window

The Breakpoints window lists the breakpoints that are currently set in your code by line number as well as the exception and method breakpoints. You can specify conditions under which each breakpoint should be hit in the Conditions column. You may also enable and disable individual breakpoints by using the checkboxes.

## Related Topics

Debugging Web Services

Working with Breakpoints

Debugging Scenarios

How Do I: Debug a Java Project?

How Do I: Debug an Application?

How Do I: Debug an Application on a Remote Production Server?