Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change variable value eclipse in debug perspective at run time

it's a long time since I used Eclipse Helios, and I found some difficult in changing variable at run time during debug.

I have put a breakpoint, and when debugger stops there it shows the object I am looking for in the 'variable' panel, which appears when in debug perspective.

The value I am trying to change is a Boolean inside the object, however these are the unsuccessful tentatives I did:

  1. Expanded the object, look for variable expanded it until it shows value, changed value to false: this results in changing all the boolean in the object
  2. Add watch expression to the boolean variable, but then I wasn't able from there to find a way to change its value

don't know if it is relevant, the application I am debugging is running on an old jboss 5.1, and the debug itself is done by running jboss in debug mode, and connect trough eclipse with a debug configuration. All is installed on my localhost.

thanks

like image 381
Leonardo Avatar asked Jul 25 '12 09:07

Leonardo


People also ask

Is it possible to change the value of a variable while debugging?

Yes u can if you have the authorization: while debugging do a doubleclick on the variable, the system'll show the name and the value of the variable, change the value and press CHANGE icon.

How can I see the variable value while debugging in Eclipse?

Press Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression to show its value. You can also add a permanent watch on an expression/variable that will then be shown in the Expressions view when debugging is on.

How do I change the value while debugging in Intellij?

Select a variable or a property of a complex object in the Debug window, press F2 or right-click and choose Set Value... from the context menu, and then specify a new value and press Enter .


2 Answers

Following steps worked for me:

  1. Click on Window -> Open Perspective -> Debug

  2. Click on Tab Variables.

  3. Right click the variable for which you want to change the value and click on Change Value...

  4. Set the Value as Boolean.TRUE in the dialogue and click Ok.

like image 178
Arpit Aggarwal Avatar answered Sep 30 '22 06:09

Arpit Aggarwal


You can change the value.

Right click on the variable add it to 'watch' and then while debugging go to 'Expressions View', there you can change value

like image 33
Rahul Avatar answered Sep 30 '22 06:09

Rahul