(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
(pprint (map (memfn getPath) (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))))
(clojure.contrib.pprint/pprint (sort (map (memfn getPath) (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))))
Thanks Pablo! ( http://pupeno.com/blog/printing-the-class-path-in-clojure/ )
An alternative that uses the system properties rather than the class loader (This is for windows, so you might want to change the ; to : on linux / os x):
ReplyDelete(re-seq #"[^;]+" (System/getProperty "java.class.path"))
The advantage is that you get rid of the URL objects.
-- Lauri