Did you use the "-cp" option to include the contrib when running
java.exe on clojure.jar? The error shows that it's looking in a
subdirectory with a .class rather than the packaged jar file.

I'd suggest using leiningen to avoid build problems like this.



On Aug 23, 6:10 am, Wanderfels <wanderf...@web.de> wrote:
> Hello,
>
> win XP, clojure 1.2.1 and clojure.contrib-1.2.0.jar here. i want to
> learn clojure (background python and javascript and a bit Haskell) and
> are currently reading the pdf 'Programming Clojure' from 2009.
> In Chapter 1.3: 'Exploring Clojure Libraries' it says:
>
> "
> Clojure code is packaged in libraries. Each Clojure library belongs to
> a namespace, which is analogous to a Java package. You can load a
> Clojure library with require:
>
>   (require quoted-namespace-symbol)
>
> When you require a library named clojure.contrib.str-utils, Clojure
> looks for
> a file named clojure/contrib/str-utils.clj on the CLASSPATH. Try it:
>
>   user=> (require 'clojure.contrib.str-utils)
>   nil
> "
>
> i did. i got:
>
>   user=> (require 'clojure.contrib.str-utils)
>   java.io.FileNotFoundException: Could not locate clojure/contrib/
> str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
> (NO_SOURCE_FILE:0)
>
> i googled a bit. i now know that:
>
> * if you type str-utils it searches for str_utils.clj, not str-
> utils.clj btw.
>   my pdf is wrong (or old) here.
> * setting CLASSPATH doesnt help (JAVA_HOME is set btw).
> * setting classpath directly with ...
>     java -classpath C:\CLOJURE\lib\clojure-contrib-1.2.0.jar -cp
> clojure.jar clojure.main
>   ... doesnt help.
> * doing add-classpath seemed to work for a guy 
> @http://stackoverflow.com/questions/1805081/clojure-cant-find-clj-in-l...
> but a) not for me ...
>
>   user=> (add-classpath "file:///C:/CLOJURE/lib/clojure-
> contrib-1.2.0.jar")
>   WARNING: add-classpath is deprecated
>   nil
>   user=> (println (seq (.getURLs (java.lang.ClassLoader/
> getSystemClassLoader))))
>   (#<URL file:/C:/CLOJURE/bin/clojure.jar>)
>   nil
>
> ... and b) it is depreaced.
>
> both str_utils__init.class and clojure/contrib/str_utils.clj are
> contained in this contrib jar at the right position. I tried removing
> the numbers from the jar. i tried extracting the contents of the jar.
> i tried moving the contrib folder to C:\CLOJURE\bin\src\clj\clojure.
> li tried moving the contrib jar to C:\CLOJURE\bin.
>
> Now i need a hint. How to import libs in Clojure?
>
> greets, Wanderfels

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