Eclipse: Update variable value in debug perspective at runtime


This is a common question asked by many developers to update the value of the variable at runtime in eclipse. This article will help to explain possible ways to update the variable values at runtime.

It was a long time since I used Eclipse, and I found some difficulties in changing variable at runtime during debugging. As a developer, we have to change the variable’s value at runtime as we have to test various scenarios without updating the data in the database. There are various ways to change the value at runtime, please follow below –

Process 1

We have to put a breakpoint, and when debugger stops there it shows the object user was looking for in the ‘variable’ panel, which appears when eclipse is in debug perspective.

The value user was trying to change is a Boolean inside the object. The user cannot change the value directly as we have to expand the object.
Expanded the object, look for variable expanded it until it shows value, changed value to false or true whatever user want to change then this results in changing the variable’s boolean in the object.

Process 2

The user can change the value using steps –

Right click on the variable add it to ‘watch’ and then while debugging go to ‘Expressions View’. A user can change the value from Expression View directly.

Process 3

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 inBoolean.TRUE the dialogue and click Ok.

Process 4

There is one more option available to set the variable value at runtime and it more efficient than others. The Display Panel can be open using two different ways –
1. Right click on the variable name while the code is in debug mode and click on Display.


2. Navigate Window option from the eclipse and click on Show view then a user will be able to see Display option.


Once User clicked on the Display option from either way as mentioned above then Display panel will be displayed along with Console, Problems etc.

A user can assign a value to its corresponding data types using appropriate values like an integer value we can assign 100 or any other integer value. Also, here we can write some code which can evaluate the value at runtime.

Once value is assigned or code written then we have to click on the execute button and once execute button clicketed then this value will be applied.

One thought on “Eclipse: Update variable value in debug perspective at runtime”

Leave a Reply

Your email address will not be published. Required fields are marked *