Recipe 5.13 Assigning Values to Variables While Debugging
You want to change the values of variables while debugging to run tests on those new values.
Just double-click a field or variable name in the Variables view, and enter a new value in the dialog that opens.
The Variables view displays the currently available variables and their values, as you can see at upper right in Figure 5-23.
Figure 5-23. Debugging with the Variables view
To change a variable's value, just double-click it, and enter a new value. For example, to change the value in loopIndex from 3 to 2 , double-click loopIndex in the Variables view, enter 2 in the dialog that opens (shown in Figure 5-24), and click OK.
Figure 5-24. Changing a variable on the fly
Note, however, that monkeying with data in a running program can break your code.
188.8.131.52 Eclipse 3.0
In Eclipse 3.0, some Java types, such as collections and maps, can be displayed in a more compact and meaningful form using variable filters . These filters are controlled with a toggle button in the Variables view.
5.13.4 See Also
Recipe 5.12 on evaluating expressions.