What is the best way to call a Clojure function from Java?
Most of the resources I have found are either very old or don't go into enough detail. I am a Clojure programmer with very little Java background, and have been having trouble with the methods I've found, especially classpath issues.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
package myco.dashed_namespace.app;
import clojure.java.api.Clojure;
import clojure.lang.IFn;
public class Main {
public static void main(String[] args) {
try {
IFn require = Clojure.var("clojure.core", "require");
require.invoke(Clojure.read("myco.dashed-namespace.app.core"));
Clojure.var("myco.dashed-namespace.app.core", "start!").invoke();
}
catch (Throwable e) {
System.out.println(e.getMessage());
}
}
}
There's a brief section on this on the Clojure website:
On 2 June 2017 at 01:35, thelmuth <trh...@gmail.com> wrote:
What is the best way to call a Clojure function from Java?--
Most of the resources I have found are either very old or don't go into enough detail. I am a Clojure programmer with very little Java background, and have been having trouble with the methods I've found, especially classpath issues.
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
----James Reeves
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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
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+u...@googlegroups.com.
https://github.com/markbastian/java-calls-clojure
Hope that helps.
-Mark