Woops.

I meant to have both occurrences of (rba-reverse) in defn -main replaced with just (reverse). I made that replacement, and still get nearly the same error message:

Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: reverse for class andy.try.ReversibleByteArray

Andy


On Jan 28, 2011, at 3:04 PM, Andy Fingerhut wrote:

Thanks for the suggestion. I'm not sure I implemented it correctly. Still no joy. Here is exactly what I tried:

% ls -R
andy

./andy:
try.clj

% cat andy/try.clj

(ns andy.try
 (:gen-class))

(gen-class
:name  andy.try.ReversibleByteArray
:prefix rba-)

(defn rba-reverse [this]
 (println "In rba-reverse"))

(defn -main [& args]
 (let [N (. Integer valueOf (nth args 0) 10)]
   (println "N=" N)
   (let [buf (new andy.try.ReversibleByteArray)]
     (println "(class buf)=" (class buf))
(println "(. buf (rba-reverse)) returns " (. buf (rba- reverse))))))

% java -Dclojure.compile.path=. -classpath $HOME/lein/clj-1.2.0/lib/ clojure-1.2.0.jar:. clojure.lang.Compile andy.try

Compiling andy.try to .

% ls -R
andy

./andy:
try                             try.class
try$_main.class                 try.clj
try$loading__4410__auto__.class try__init.class
try$rba_reverse.class

./andy/try:
ReversibleByteArray.class

% java -server -classpath $HOME/lein/clj-1.2.0/lib/ clojure-1.2.0.jar:. andy.try 5
N= 5
(class buf)= andy.try.ReversibleByteArray
Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: rba_reverse for class andy.try.ReversibleByteArray
        at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:50)
        at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
        at andy.try$_main.doInvoke(try.clj:16)
        at clojure.lang.RestFn.applyTo(RestFn.java:138)
        at andy.try.main(Unknown Source)


Andy


On Jan 28, 2011, at 2:46 PM, Ken Wesson wrote:

On Fri, Jan 28, 2011 at 5:20 PM, Andy Fingerhut
<andy.finger...@gmail.com> wrote:
----------------------------------------------------------------------
(ns try
(:gen-class))

Try using a two-component (or more) namespace name. I think gen-class
in a one-component namespace will try to create the class in the
default package, which Java does not like.

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