Re: AOT compilation and calling Clojure from Java

2010-08-16 Thread sebastien
Yes, it helped! Thank you! To make the story complete I put here complete code: semantic/hello.clj: (ns semantic.hello (:gen-class :name semantic.hello :methods [[sayhello [] void] [sayhello_arg [String] void]])) (defn -sayhello [this] (println "Hello from Clojure!"))

Re: AOT compilation and calling Clojure from Java

2010-08-16 Thread Wilson MacGyver
you'd import semantic.hello then in your java code, you would first create it by doing new semantic.hello() then you can call it form java by doing .sayhello() without the - you also need to define your sayhello differently I think. it needs to be (defn -sayhello [this] (println "Hello from cl

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread Meikel Brandmeyer
Hi, On 15 Aug., 21:41, sebastien wrote: > Unfortunetly it doesn't work, pointing to h.hello() and saying "cannot > find symbol". > > Any suggestions? First the method is called sayhello. Not just hello. Then you have to declare the method in the gen-class clause. (ns semantic.hello (:gen-cla

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread sebastien
I tried to compile hello.clj with "lein compile" and with "(compile 'semantic.hello)", and also with old versions of clojure.jar and clojure.contrib.jar (current one is 1.2-beta1), but it all gave the same result. -- You received this message because you are subscribed to the Google Groups "Cloju

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread sebastien
> Can you run: > javap YourClass.class > and give us the result? Here it is: public class semantic.hello extends java.lang.Object { public static {}; public semantic.hello(); public java.lang.Object clone(); public int hashCode(); public java.lang.String toString();

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread Daniel Gagnon
> > > Any suggestions? > > Can you run: javap YourClass.class and give us the result? -- 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 - plea

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread sebastien
Hi Meikel, Unfortunetly it doesn't work, pointing to h.hello() and saying "cannot find symbol". ^ Same with my Eclipse, which says that import "semantic" cannot be resolved, though both package and class are in the bin (classes) directory.

Re: AOT compilation and calling Clojure from Java

2010-08-15 Thread Meikel Brandmeyer
Hi, Am 15.08.2010 um 18:04 schrieb sebastien: > I understand that after AOT compilation Clojure namespaces and > functions became completely normal Java classes and can be called from > any Java code, is it correct? If so, how will look like this call? For > example, I have clojure module: > > (

AOT compilation and calling Clojure from Java

2010-08-15 Thread sebastien
I understand that after AOT compilation Clojure namespaces and functions became completely normal Java classes and can be called from any Java code, is it correct? If so, how will look like this call? For example, I have clojure module: (ns semantic.hello (:gen-class)) (defn -sayhello [] (print