On Tuesday, April 26, 2016 at 4:38:02 PM UTC-5, Martin Grześlowski wrote:
>
> I'm trying to compile String that contains Clojure Script code in 
> Java/Groovy. 
>
> I'm not really happy with using *"java -jar ...".execute()*.
>
>
> Is there any way to invoke clojurescript library (version 1.8.51) to 
> compile code?
>

The clojurescript compiler is a clojure library, so you can invoke it from 
Java the same way you can invoke any Clojure code from java.

Basics of invoking Clojure from Java: http://stackoverflow.com/a/23555959

It will probably look something like:

IFn require = Clojure.var("clojure.core", "require");
require.invoke(Clojure.read("cljs.build.api"));
IFn build = Clojure.var("cljs.build.api","build");
build.invoke("src", Clojure.read("{:output-to ...}"));



The second argument to build can be a HashMap you construct in your Java 
code. (Make sure the keys are Keyword type.)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to