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

前端 未结 28 1255
一个人的身影
一个人的身影 2020-11-29 16:38

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

28条回答
  •  囚心锁ツ
    2020-11-29 16:55

    While JRuby, BeanShell, Julian Fleischer's REPL are there Albert Latacz's REPL seems to be the latest and active.

    Tried it with a simple class definition, works fine.

    $ java -jar javarepl.jar
    Welcome to JavaREPL version 56 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_17)
    Type in expression to evaluate.
    Type :help for more options.
    
    java> public class Test {
        | public static void execute(String [] s) {
        |  System.out.println(54353 + s[0]);
        | }}
    
    java> Test.execute(new String [] {"234343"});
    54353234343
    
    java> System.exit(0);
    

提交回复
热议问题