2010/12/22 Meikel Brandmeyer <m...@kotka.de> > Hi, > > Am 22.12.2010 um 10:13 schrieb Mark Engelberg: > > > I'm trying to figure out how to bundle up some Clojure code into a jar > > to be accessed by someone in Java. > > > > My google search turned up this link: > > http://java.dzone.com/articles/java-clojure-interop-calling > > which dates back to Clojure 1.1. > > > > Seems like a lot of changes have occurred since then -- static > > functions, protocols, etc. So has the "calling Clojure from Java" > > story changed with Clojure 1.3? If so, can anyone provide pointers to > > some recent examples? > > If you just want to invoke some functions, you don't have to define a > class. You can retrieve the corresponding Vars. > > Var someFn = RT.var("you.name.space", "some-fn"); > … > someFn.invoke("Some", "arguments", goHere, 123); > > It is a little ugly, but works with any function, in particular static and > protocol functions. If you want a less rough interface, you can still go the > gen-class route from the article. But this will come at the cost of one > level of indirection on method calls. >
There's also this issue raised in the bug tracker (by Chas Emerick I presume ?) which is about adding a nice java facade for this kind of interop (and thus also ensuring some independance towards clojure internals). What about bringing it back to the table for inclusion in 1.3 ? -- 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