且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何轻松地用 Java 编写 REPL 应用程序?

更新时间:2023-10-16 16:57:58

我在 Groovy 中得到了这个.

I got this working with Groovy.

public static void main(final String[] args) {

    Binding binding = new Binding();
    // Configure your bindings here.

    Groovysh shell = new Groovysh(binding, new IO());
    shell.run(args);
}

已知问题

但是,当应用程序从 Eclipse 启动时(即使用 Eclipse 的控制台"视图),它不会工作.要解决此问题,您必须更新 Eclipse 启动配置以传递以下 VM 参数:
-Djline.terminal=jline.UnsupportedTerminal.

Known Issues

However, it won't work when the app is started from Eclipse (ie using the Eclipse 'console' view). To work around this you must update the Eclipse launch configuration to pass the following VM argument:
-Djline.terminal=jline.UnsupportedTerminal.