Reputation: 12633
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?
Upvotes: 4
Views: 2215
Reputation: 862
edit, Also, check that the main class name matches the one defined in the lein project file.
Usually you put in the (ns) header of the clj file.
(ns my.namespace
(:gen-class))
Here's some examples
(gen-class
:name "some.package.RefMap"
:implements [java.util.Map]
:state "state"
:init "init"
:constructors {[] []}
:prefix "ref-map-")
Upvotes: 1