Accepted answer

There is a Display view as well that can do exactly what you want. Go to Window > Show view > Display (or Other... if the Display view is not there. In the Display view, you can type any code you want during debug (content assist is available). The current objects and variables are also available to use. After you wrote your code, you have to highlight it, right click and select Execute or hit CTRL-U. You may play around with the other possible actions as well.

Besides that, you can also write in the source code during debug and evaluate it using Display as you mentioned, if you have the source for the class you are debugging.


Select any expression in your code. Then right-click and select "Display" (or press the associated key-combination).

For completely new expressions, use the Display view. It's like a scrapbook for expressions. If the Display view is not visible, select Window > Show view > Display to add it. Then type any expression in the view, and do the same thing as for expressions in your code: select the expression, right-click and select "Display".

For expressions that you want to always see the value of, every time execution is halted, use the Expressions view instead.


You can change variable values on the fly using the Debug perspective. The top right corner of Eclipse should have the variables view from which you can select a variable name and change its value. You can also set conditional breakpoints by selecting the breakpoints view in the top right corner of Eclipse. Right-click on the breakpoint and select breakpoint properties. Check the conditional checkbox and write an expression that only when it evaluates as true does the program suspend during Debugging.

Change Variable Values during Debug

Conditional Breakpoints


Although Display View works; There are two ways else to evaluate an expression.

  1. In the context of the debugging session, we can write and run custom code to evaluate possibilities. This is done in the Debug Shell. For example, if we need to cross-check the correctness of the sqrt functionality, we could do it in the Debug Shell. On the code, Right-click -> Inspect to see the value.
  2. You can select an expression then open Context Menu -> Inspect or press CTRL + Shift + I, during debugging, the result will be displayed.


1 - Type your expression inside a method that you are debugging

2 - Select that code

3 - Press CTRL + SHIFT + I

4 - Eclipse will evaluate your expression and show the results in a floating window

Related Query

More Query from same tag