Watching variables contents in Eclipse IDE

JavaEclipseDebugging

Java 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"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkarlicossView Question on Stackoverflow
Solution 1 - JavaPhuongView Answer on Stackoverflow
Solution 2 - JavaMatt BallView Answer on Stackoverflow
Solution 3 - JavaRobert GrutzaView Answer on Stackoverflow
Solution 4 - JavaMuhammad Imran TariqView Answer on Stackoverflow
Solution 5 - JavanahikoView Answer on Stackoverflow