26

I am debugging in NetBeans IDE, where can I see assigned variables and their values?

4 Answers 4

55

While you're in the debugger go Window -> Debugger -> Variables

Sign up to request clarification or add additional context in comments.

2 Comments

you gotta run the debugger xD
Is there a way to see the return value of a method, assuming it's not assigned to a variable.
8

You can also use ALT+SHIFT+1 to bring up variable viewer.

Comments

4

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.

1 Comment

My netbeans showing GLOBAL variables but not my local variables
3

There exists another solution that is

  1. Press Ctrl+F9 to display Evaluate Expression Panel/Tab
  2. Enter variable name in Evaluate Expression Panel/Tab
  3. 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 :-)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.