简体   繁体   中英

Can not get clojure-contrib to load - FileNotFoundException

I have tried putting clojure-contrib.jar various places on my filesystem, I have tried manually specifying the classpath when launching the REPL, I have tried extracting the jar and putting the clj files on the classpath, nothing seems to work. I continue getting something like this:

java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.
class or clojure/contrib/str_utils.clj on classpath:  (NO_SOURCE_FILE:0)

When I execute (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))) to see the classpath, it does include clojure-contrib:

(#<URL file:/C:/Program%20Files/Java/jre1.6.0_06/lib/clojure-1.0.0.
jar> ... #<URL file:/C:/Program%20Files/Java/jre1.6.0_06/lib/clojure-contrib.jar>)

When I make a .clj file of my own and put it on the classpath I am able to use or require it and have access to its functions as I'd expect.

If I move a .clj file - str-utils.clj for instance - to the pwd (which is on the classpath) it sorta works - it at leasts finds the file, although it generally can't do anything with it because of dependencies on other functions buried in clojure-contrib which it can't find.

Any ideas why this wouldn't work for clojure-contrib?

If you compiled your own clojure-contrib jar, you probably used the main branch which is not 1.0 compatible.

Follow the Using clojure-contrib with Clojure 1.0 doc to checkout the 1.0 tagged revision of clojure-contrib.

There is also a clojure-contrib git branch that maintains 1.0 compatibility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM