This is a minor annoyance for me that keeps coming up. When I'm debugging a program I can see variables in the immediate scope, but I can't see variables which are global, static, or variables inherited by 'this' class. The only way I know how to get these values for testing is to create a dummy variable to store the variable I want within scope of a given function, which isn't efficient or elegant.
Is there an easier way to see the value of any/all of the three variable types I mentioned while stepping through the debugger?
Thanks
Variables. We can see the values of variables during the execution under the Variables view. In order to see the static variables, we can select the drop-down option Java -> Show Static Variables. Using the variables view, it's possible to change any value to the desired value during the execution.
You can go to the quick-watch window - Ctrl + Alt + Q , enter the variable name there, and press Add Watch . The variable will be added to the Watch window. Save this answer. Show activity on this post.
Alternatively, do Ctrl + Shift + I after selecting the expression. If you want to continuously evaluate an expression, say because it is within in a loop, you can watch it in the Expressions view.
Expanding the entry for this
in the Variables
view in the Debug Perspective
should let you view all of those (non-static) members already, by default.
To view constants and static members, in the Variables
view's menu (opened by clicking the little down arrow at the top right of the view), choose Java > Show Static Variables
or Show Constants
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With