I am debugging in NetBeans IDE, where can I see assigned variables and their values?
4 Answers
While you're in the debugger go Window -> Debugger -> Variables
-
5
-
Is there a way to see the return value of a method, assuming it's not assigned to a variable.– SeanDec 9, 2020 at 6:18
Generally, the pane underneath the code has some tabs - and one of them will say 'Variables'. Click on that tab and you will see variables and their values. You need to be actually running a debug session before the variables tab is available.
For this to show all local variables you need to have the line:
xdebug.show_local_vars=1
in your xdebug.ini file. Don't forget to restart Apache if you add that line.
If you are not seeing all local variables then you may have hit the problem where your version of the module file (xdebug.so) has a bug. This is the case currently for Ubuntu 10.04.
To fix this you need to compile a newer version of the xdebug.so file. Follow the instructions at http://xdebug.org/wizard.php to get your new file which should replace your current xdebug.so file.
There exists another solution that is
- Press Ctrl+F9 to display
Evaluate Expression
Panel/Tab - Enter variable name in
Evaluate Expression
Panel/Tab - Press Ctrl+Enter (or arrow icon at right of
Evaluate Expression
Panel/Tab
The variable's value is then displayed in Variables
Panel just below (on my PC) Evaluate Expression
Panel/Tab.
You can also use this solution to display EXPRESSION and not only VARIABLE !
Example: (String sSheetData is a String variable that contains a very big string)
sSheetData.substring(4000,4200);
StringTools.Right(sSheetData,100);
StringTools.Mid(sSheetData,4000,200);
This is also possible using New Watch
callable using contextual menu.
But this is not as easy as using Immediate Windows
on Microsoft Visual Studio :-)