2008-05-07
| 08:04 | asbjxrn | If I want to call clojure from java, I guess I have to add clojure as a library and import some classes? Is clojure.jar enough? |
| 08:08 | asbjxrn | I'm thinking of using something along the lines described in the "java web start and clojure application" thread. (http://groups.google.com.sg/group/clojure/browse_thread/thread/f0c69735c5a9bd03/1e0dced366af9077?lnk=gst&q=webstart#1e0dced366af9077) |
| 08:09 | asbjxrn | So I can use the interface designer in netbeans and just have the main function start the RT and hand over the control to clojure. |
| 08:18 | cgrand | asbjxrn: are you using a recent clojure form SVN or the last release? |
| 08:19 | cgrand | form -> from |
| 08:19 | asbjxrn | From SVN |
| 08:21 | cgrand | ok, now it's even silmpler to embed Clojure. You only need clojure.jar and a file named user.clj (in the classpath). |
| 08:21 | asbjxrn | I'm trying to use enclojure. Not sure how to get the clojure.jar included. I've added it to the libraries of my project, but I get a package jvm.clojure.lang does not exist when I try to import jvm.clojure.lang.RT |
| 08:22 | cgrand | In java code, just do something like RT.var("namespace", "name").invoke(....) and you are done. |
| 08:23 | cgrand | I don't have experience with enclojure but RT is clojure.lang.RT not jvm.clojure.lang.RT, "jvm" is the name of the root source folder |
| 08:24 | asbjxrn | Ah. It should be import clojure.lang.RT, not import jvm.clojure.lang.RT... |
| 08:24 | cgrand | yes |
| 08:30 | asbjxrn | Hmm. That user.clj trick is neat. But I guess I should then make my gui as a class instead of an swing application. |
| 08:30 | asbjxrn | To avoid conflicts with main(). |
| 08:35 | cgrand | user.clj won't get |
| 08:36 | cgrand | (oops I hit [enter]) |
| 08:38 | cgrand | Clojure won't get initialized (and thus user.clj executed) until you use it. I don't understand where you see a conflict with main(). |
| 08:45 | cgrand | (I read what you wrote on #enclojure:) Yeah user.clj is here to help you automatically define and populate your namespaces, I don't think Rich intended it to be the main entry point to the program. |
| 08:47 | asbjxrn | I thought I saw something on the google group about user.clj being used as an entry point. Could be for the REPL/script class? Or more likely, I misunderstood. |
| 09:05 | asbjxrn | Ok, got that part working... Now to do something useful... |
| 09:05 | cgrand | :-) |
| 17:29 | nsinghal | is there a function in clojure for doing modulo arithmetic? |
| 17:29 | Chouser | rem |
| 17:34 | nsinghal | thanks |
| 18:34 | meredydd | So, what *is* the official entry point for a Clojure program? |
| 18:35 | meredydd | References are made to compilation, but is there a compiler that will give me a class with the traditional static main() method? |
| 18:37 | meredydd | The method in scrollback seems to be about dynamic loading from a java class |