I’m a big fan of the iPython interpreter. I like having an interpreter running while I develop for prototyping and debugging. Since I currently develop in java primarily, I thought I’d take a look at what java interpreters are available. I had three main features which I wanted. In order of importance:
- Basic history and command editing, at least as good as bash.
- Autocompletion. At a minimum, autocomplete built-in commands and previously seen code. Ideally, autocomplete instance methods from loaded libraries.
- Eclipse compatibility. Ideally, it should run as a eclipse plugin. Baring that, it should be able to find the most recently compiled version of class files (for instance, through a local maven repo).
Sadly, none of the solutions I found fulfilled all three of my requirements.
Groovy is a dynamic language that runs on the JVM. Java code is valid Groovy code, but groovy includes a lot of nice dynamic features ala python or ruby, such as dynamic typing. The community feels very rails-like, with a popular agile web server (Grails) which holds most of the die-hard interest, and plenty of hip conferences.
Pros: Dynamic language, fully compatible with java. Comes with an interpreter. Active development, including a MacPorts installer. Strong community. Bash-like history feature.
Cons: Hard to configure correctly (classpaths, maven integration, etc). No autocompletion, no eclipse integration.
BeanShell is a java interpreter. It’s actually quite similar to Groovy, but positions itself as a dev tool rather than a new language. The documentation refers to autocompletion features, but they didn’t work for me. It only seems to have been developed for 6 months in 2005 by two developers, so that’s not surprising.
Pros: Bash-like history feature. Embeddable!!!! (<--this is useless to me.)
Cons: No development since 2005, no autocompletion, no eclipse integration, tricky to get classpath right.
No autocompletion? Did you try jLine, you ask? Yes, I did find and follow those arcane instructions for wrapping BeanShell with the java version of readline. It was a pain, and it didn’t even autocomplete words from my history. FAIL.
The command-line tools didn’t seem to be cutting it, so I checked out EclipseShell, which is an eclipse wrapper for BeanShell. This one almost worked, but feels like a beta or first release. Screenshots show autocompletion, but it sure doesn’t work on current versions of eclipse. The interface tries to be this matlab-style cell format, but just looks like a text editor. In short, good idea but no followthrough.
Pros: Edit like a text file, eclipse integration, easy installation.
Cons: broken autocompletion, no recent development.