Interactive Java code execution?
Hello,
is there a functionality to execute Java code interactively in IDEA like the "Java scrapbook" in Eclipse?
This is sometimes very usefull to test little code snippets.
Thanks in advance,
Helge
Please sign in to leave a comment.
Hi Helge,
There is no exact analogue at IJ.
The closest feature is 'evaluate expression/code fragment' during debugging.
Alternatively, you can create simple groovy script and do what you want there using java syntax.
Regards, Denis
There is also a BeanShell plugin maybe that is what you are searching.
BeanShell is a scripting dialect of Java.
Almost all valid Java 5 code is also valid in BeanShell.
A Groovy script is a little to heavy for me because I don't want to install/setup Groovy just to evaluate a small Java snippet like
"abc\\def".replaceAll("\\\\", "\\\\\\\\");
Then I still think the BeanShell plugin could be what you are after if it is done correctly.
The BeanShell integration into jEdit and possibly the Console plugin would be exactly what you need.
I'll try this tomorrow at work.
Helge
I'm afraid complexity of that operation is slightly overstated - download groovy binaries and setup their location at jetgroovy plugin doesn't look too heavy :)
Denis