Watching variables contents in Eclipse IDE
JavaEclipseDebuggingJava Problem Overview
How can I watch the contents of several variables (for example, TreeSet's) simultaneously? I can watch contents of one TreeSet, clicking on it in "Variables" window, but I have no idea how to do that for several variables.
Java Solutions
Solution 1 - Java
You can use Expressions windows: while debugging, menu window -> Show View -> Expressions, then it has place to type variables of which you need to see contents
Solution 2 - Java
You can add a watchpoint for each variable you're interested in.
> A watchpoint is a special breakpoint that stops the execution of an application whenever the value of a given expression changes, without specifying where it might occur. Unlike breakpoints (which are line-specific), watchpoints are associated with files. They take effect whenever a specified condition is true, regardless of when or where it occurred. You can set a watchpoint on a global variable by highlighting the variable in the editor, or by selecting it in the Outline view.
Solution 3 - Java
This video does an excellent job of showing you how to set breakpoints and watch variables in the Eclipse Debugger. http://youtu.be/9gAjIQc4bPU
Solution 4 - Java
You can do so by these ways.
Add watchpoint
and while debugging you can see variable in debugger window perspective under variable tab.
OR
Add System.out.println("variable = " + variable);
and see in console.
Solution 5 - Java
And how about selecting the text you want to watch, and then using the shortcut "Ctrl + shift + I"