Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not get clojure-contrib to load - FileNotFoundException

Tags:

clojure

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?

like image 464
Tim Avatar asked Dec 01 '09 12:12

Tim


1 Answers

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.

like image 198
Cristian Avatar answered Oct 26 '22 13:10

Cristian