you can also create a scrapbook page (a .jpage) file and type your code in there. then click run. it looked slightly more convenient when i tried it.


like others say, you use the display view. but for some variants of eclipse, it may be named differently. for instance, if you are using spring tool suite as your eclipse, the view name corresponding to display view is debug shell.


complementing all the amazing answers, for mac users is cmd + d


you can use the 'display' view to evaluate expressions in eclipse.

look under the debug list of views. it is a standard par part of the java tooling so you don't need a plugin


i'm currently using eclipse photon (v4.8.0). eclipse changed the "display" view name to "debug shell view". here, you can execute commands on-the-fly.


i believe that what you're looking for are "watch expressions". just mark the piece of code in the source code view, right-click and select "watch".


use the debug shell! coming from node, i was pretty used to being able to mess with my env variables at any time using node --inspect in chrome, and so it was imperative for me to find the same experience in eclipse without having to use jdb.

to open the debug shell, go to window → show view → debug shell

after you write the code you wish to run, simply highlight it, right click, and execute (⌘u also works)

using the debug shell


select the line and press ctrl+shift+d or ctrl+shift+i this will give the result in a popup.


you can use the display view to execute commands while debugging. you can find this in window -> show view -> display


use the display view, or a bit quicker: highlight the code you want to run and right-click/execute or ctrl+u.

Related Query

More Query from same tag