开发者

Watching variables contents in Eclipse IDE

开发者 https://www.devze.com 2023-02-24 12:00 出处:网络
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 开发者_如何学JAVAI have no

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 开发者_如何学JAVAI have no idea how to do that for several variables.


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


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.


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.


And how about selecting the text you want to watch, and then using the shortcut "Ctrl + shift + I"

0

精彩评论

暂无评论...
验证码 换一张
取 消