Java's interactive shell like ipython

Viewed 16748

I am quite new to Java and would like to learn Java using an interactive shell, like I did with Python using IPython.

I have tried a few interactive shells, such as beanshell, jython, jythonconsole, and JyConsole. Most of them don't have tab completion like IPython does. Is there anything similar to IPython for java?

9 Answers

You probably won't get much use out of using java interactively, as that language is strongly oriented toward compiling. The best route will probably just get a nice IDE, like eclipse, and get started with breakpoints and the debugger.

what beanshell have you used ? the old one ? Look at this they claim to provide completion

Gayan Weerakutti already mentioned in a comment what I think should be the correct answer, too: JShell is part of the JDK since version 9. Try jshell on your terminal. Check out docs from Oracle about it.

I think I find a good enough alternative: JPype. JPype allows python programs having full access to java class libraries. With JPype and IPython, I can use all java functions while having very nice tab completion for the java classes.(After the class is imported though)

IntelliJ IDEA has a groovy console with tab completion.

open it: Tools -> Groovy Console...

Related