How to execute a javascript with jshell?

后端 未结 4 1001
自闭症患者
自闭症患者 2020-12-08 08:07

Given that Java 9 is upon us and we can finally have a java REPL with jshell I was hoping there was a way to add a shebang to a script and have jshell

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 08:43

    Inspired by steiny answer, I came up with a more generic solution

    https://gist.github.com/ffissore/012d7e32a096fde5266f49038c93dcaf

    In essence: jshell-wrapper will strip the first line of the script (which is supposed to be the shebang) and will add a /exit at the end of the script

提交回复
热议问题