Hi,

I'm trying to construct a Java obj from a from a classname string.
I've managed to import the thing using a macro:

(defmacro import-by-name [name] `(import [~name]))
(let [klass-name "foo.bar.Baz"
       the-ns (import-by-name klass-name)
       the-obj (new foo.bar.Baz arg)] ...)
       ....

But when I use a string instead of literal arg to new I get "Unable to
resolve classname":
      ...
      the-obj  (eval `(new ~klass-name ~arg))
      ...]

The error message has the right classname, which is in test/classes as
expected (leiningen proj.).  So I can use a string to import the
class, but not to create an object of the class.

What am I doing wrong?

Thanks,

Gregg

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to