In eclipse, while debugging, how do I access the interactive-top-level (a.ka. the "display console")?

JavaEclipse

Java Problem Overview


In most programming languages I've used, when debugging, when I hit a breakpoint, I have the ability to execute arbitrary code (whatever I type into the console after the breakpoint has been hit).

How do I do this in Eclipse? The debugging mode has, by default, a display console, but no interactive console (into which I can input Java code for immediate execution)

Java Solutions


Solution 1 - Java

You can use the Display view to execute arbitrary code, access it via:

> window->Show View->Display

then type the code you want to execute (you can use CTRL+SPACE for autocomplete).

to execute the code, select it then:

> CTRL+SHIFT+D

That should execute the code based on the breakpoint you've hit.

alt text

Note: As of 2018, Display View has been renamed to Debug Shell View.

Solution 2 - Java

Eclipse has it indeed. Window->Show View->Interactive Console. Note that you can also execute expressions in the Watch view (e.g. result=false, exception.printStackTrace() etc.).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAaron FiView Question on Stackoverflow
Solution 1 - JavaJonView Answer on Stackoverflow
Solution 2 - JavadigitalbreedView Answer on Stackoverflow