1
votes

I created a basic hello world class in eclipse with clojure and counterclockwise and I'm able to compile it with clojure no problem.

(ns ca.ckovacs.test.helloWorld
    (:gen-class))

(defn -main
  [greetee]
  (println (str "Hello " greetee "!")))

I see that this generates three classes in my /classes folder:


helloWorld__init.class
helloWorld$_main__135.class
helloWorld$loading__6309__auto__133.class

But why don't I get a helloWorld.class?

I eventually want to be able to use a Clojure compiled class within Eclipse.

I must be missing something obvious, but reading through the Compilation page at clojure.org, the posted example hello world says you can just load the helloWorld class like any other java class.

Thanks.

2

2 Answers

3
votes

I don't know what the problem was, but I ended up renaming my package name and I get the helloWorld.class file as expected.

I suspect the problem may be because I had two seperate source paths (one for Java, one for Clojure) that shared the same package namespace.

2
votes

Hmmm... Since no one else has provided an answer, I'll try to give some guidance even though I don't use Eclipse or Counterclockwise.

If you want to treat your Clojure functions like static methods when calling from Java, you need to add some information to your (gen-class) statement, particularly :methods keyword.

See my answer to "Calling Clojure from Java" a few days ago. It provides an answer developed on NetBeans and enclojure that may provide some guidance for your problem.

Dealing with classes/object/inheritance between the two languages is a bit more complicated.