A problem has traped me for quite a while when I'm exploring Clojure. I try 
to generate a class by invoking the <code>compile</code> function in REPL 
on a Clojure script as below:

    (ns mylib.DirLister (:gen-class))
    (defn -listDir [this path]
         (->> path java.io.File. .listFiles (map #(.getName %))))

I saved this script to _e:/temp/clj/src/mylib/DirLister.clj_. The following 
session goes well when I specify the **relative paths** for the 
<code>-cp</code> option, i.e., classes are successfully generated in the 
classes path:

    e:\temp\clj>java -cp 
.\src;.\classes;d:/tools/clojure-1.4.0/clojure-1.4.0.jar clojure.main
    Clojure 1.4.0
    user=> (compile 'mylib.DirLister)
    mylib.DirLister
    user=>

But when I use **absolute paths**, there prompt a "No such file or 
directory" error:

    e:\>java -cp 
e:/temp/clj/src;e:/temp/clj/classes;d:/tools/clojure-1.4.0/clojure-1.4.0.jar 
clojure.main
    Clojure 1.4.0
    user=> (compile 'mylib.DirLister)
    CompilerException java.io.IOException: No such file or directory, 
compiling:(mylib/DirLister.clj:1)

    user=>

How come ? I mean why the absolute paths don't work but the relative paths 
do.

I know I could go with leiningen. but since I'm studying Clojure, I want to 
understand the stuff underneath before adopting this full-featured tool.

-- 
-- 
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/groups/opt_out.


Reply via email to