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
<objectNameYouCreated>.sayhello() without the -

you also need to define your sayhello differently I think.

it needs to be  (defn -sayhello [this] (println "Hello from
clojure!")) Only -main doesn't need
"this"

On Sun, Aug 15, 2010 at 12:04 PM, sebastien <sebastien....@gmail.com> wrote:
> 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 [] (println "Hello from clojure!"))
>
> (defn -main [] (-sayhello))
>
> and I want to call function -sayhello from Java program:
>
> import ???
>
> class Test {
>
>    public static void main(String[] args) {
>         ???
>    }
>
> }
>
> What should I write instead of ??? signs?
>
> I know that the answer is easy, but it seems like I'm missing
> something all the time.

-- 
Omnem crede diem tibi diluxisse supremum.

-- 
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

Reply via email to