Is there something like python\'s interactive REPL mode, but for Java?
So that I can, for example, type InetAddress.getAllByName( localHostName )
in a window, a
edit Since Java 9 there's JShell
Original answer follows
You can also use Groovy Console. It is an interactive console where you can do what you want. Since Groovy also includes classes from the core java platform, you'll be able to use those classes as well.
It looks like this:
Jython is a python implementation which lets you inspect and interact with Java objects.
>>> from java.net import *
>>> InetAddress.getAllByName("google.com")
array(java.net.InetAddress,[google.com/209.85.171.100,
google.com/74.125.45.100,
google.com/74.125.67.100])
Jython, JIRB for JRuby, Groovy (groovyconsole et al) and Beanshell are all viable options.
I've used the InteractiveConsole
for Jython, it really worked nicely in the app.
As an alternative to Groovy, try Beanshell: http://www.beanshell.org/
It is more Java-like and allows you to use Java-syntax directly.
Most IDE's have a window called something like "immediate mode" that will allow you to evaluate java code on the fly.
For java 8, there is nudge4j. see https://github.com/lorenzoongithub/nudge4j
... and the beauty is that you can pilot your application from the browsert