[英]If I have a simple Clojure print statement as a String in Java, how can I execute it with Clojure?
String printcode = "(print "foo")";
如果我在Java中有上面的String,无论如何在Java内部通过clojure执行它?
The following should work (assuming that you have properly set up dependencies and initialised the Clojure runtime): 以下应该工作(假设您已经正确设置了依赖关系并初始化了Clojure运行时):
import clojure.lang.RT;
import clojure.lang.Compiler;
...
Compiler.eval(RT.readString("(print \"foo\")")));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.