Search code examples
clojuregen-class

What is wrong with my simple Clojure gen-class script?


I'm trying to learn how to use gen-class in Clojure. I've started with this simple script:

(gen-class :name MyClass :prefix MyClass-)

(defn MyClass-toString[this] "This Is My Class")

(println (MyClass.))

When I try to run it I get

    Exception in thread "main" java.lang.IllegalArgumentException: Unable to resolve classname: MyClass

What am I doing wrong?


Solution

  • You need AOT compilation for gen-class.