Search code examples
javaread-eval-print-loop

Is there something like python's interactive REPL mode, but for Java?


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, and immediately get results, without all this public static void nightmare() thing?


Solution

  • 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:

    Screenshot of Groovy