Hello everyone.

I am just starting out in Clojure by working through Programming Clojure. I have run into a snag, though, on the reader/tasklist.clj example in chapter 3. I am getting the following error consistently:

user=> (compile 'reader.tasklist)
java.lang.ClassNotFoundException: reader.tasklist (tasklist.clj:13)

Line 13 is this line in the task-list defn:

    (let [handler (new reader.tasklist)]

My complete reader/tasklist.clj is:

(ns reader.tasklist
  (:gen-class
   :extends org.xml.sax.helpers.DefaultHandler
   :state state
   :init init)
  (:use [clojure.contrib.duck-streams :only (reader)])
  (:import [java.io File]
           [org.xml.sax InputSource]
           [org.xml.sax.helpers DefaultHandler]
           [javax.xml.parsers SAXParserFactory]))

(defn task-list [arg]
  (let [handler (new reader.tasklist)]
    (.. SAXParserFactory newInstance newSAXParser
        (parse (InputSource. (reader (File. arg)))
               handler))
    @(.state handler)))

(defn -main [& args]
  (doseq [arg args]
    (println (task-list arg))))

(defn -init []
  [[] (atom [])])

(defn -startElement [this uri local qname atts]
  (when (= qname "target")
    (swap! (.state this) conj (.getValue atts "name"))))

I've compared this very thoroughly to examples/tasklist.clj in the Github dist, but can't find any errors.

I'm working in a directory that has a "reader" sub-dir and a "classes" sub-dir. "tasklist.clj" is in the "reader" directory. My REPL is launched from my own hand-rolled launcher, but the command it executes is basically:

java -cp .:/home/users/rjray/lib/clojure/clojure-contrib.jar:/home/users/rjray/lib/clojure/clojure.jar:/home/users/rjray/lib/java/jline.jar jline.ConsoleRunner clojure.main

Everything up to now has run fine from within the REPL, this is the first time I've tried compiling a class. I get the same error if I try C-c C-k from a SLIME-enabled buffer in Emacs, as well.

Any suggestions?

Randy

--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray                 Sunnyvale, CA                 http://www.rjray.org
rj...@blackperl.com                                         http://www.svsm.org
randy.j....@gmail.com

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