Is it possible to evaluate a expression in Eclipse similar to IntelliJ. Where you can dynamically type code and the result will be displayed during debug?. I know it does something similar "Display" but you need to highlight code that has been written (so you cant write any new code unless you re-compile).
Perhaps there are plugins that i could use?. I have just started using eclipse
Solution. Highlight the variable or expression while debugging, right-click it, and select Watch, or select Run→ Watch. The variable or expression, along with its value, will appear in the Expressions view from then on.
When we start the program in debug mode, Eclipse will prompt with an option to switch to the Debug perspective. The Debug perspective is a collection of some useful views that help us visualize and interact with the debugger. We can also switch to the Debug perspective manually at any time.
A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With