Attach a clojure / scala repl to a running JVM

纵饮孤独 提交于 2019-12-02 17:32:45

Copied over the answer from the other question as per your request:

liverepl: Connect a Clojure REPL to running Java or Clojure processes without any special setup

From the website: Start a Clojure REPL connected to any running Java or Clojure process without needing the process to be setup in any special way beforehand. Now supports connecting to Tomcat web applications. You can use the repl to run code, inspect variables, and redefine Clojure functions.

https://github.com/djpowell/liverepl

Kevin Wright

There's no way to attach a REPL to an already-running JVM, so you need to think about the problem backwards...

Start the REPL on the server, either when the program is launched or in response to a inbound client connection (using e.g. Telnet).

There's a good example here: http://blog.homecloud.ca/2010/03/scripster-interactive-scala-repl-using.html

You could also host an Interpreter instance in your server, then expose a web interface. This is the approach taken by http://www.simplyscala.com/


If you're thinking of debugging, then you'd be better served by this answer: Drop into interpreter during arbitrary scala code location

You could use this: https://github.com/wirde/swank-inject

Allows you attach a Clojure repl to a running java process (with remote debugging enabled).

You are also able to specify a number of classes (singletons) for which instances will be found and bound to a symbol available in the repl.

For Scala REPL connecting to other JVM, take a look at Scalive.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!