Test case:

---

(add-classpath "file:///home/user/.maven/repository/commons-io/jars/
commons-io-1.4.jar")

(ns import-testcase
  (:refer-clojure)
  (:import (org.apache.commons.io FileUtils)))

---

Loading code above results in java.lang.ClassNotFoundException. This
is beacuse clojure.core/import uses java.lang.Class#forName(String)
method to load class, which in turn uses classloader that clojure
runtime was started with. Classes added to classpath using
(add-classpath) are not visible.

Shouldn't import handle also classes added to classpath by
add-classpath? If so here's the patch that fixes it (by using
java.lang.Class#forName(String,boolean,ClassLoader) method):

http://groups.google.pl/group/clojure/web/import-fix.diff

If throwing ClassNotFoundException is desirable can someone provide me
with another way to use unqualified classes added to classpath using
add-classpath? Fully qualified class names are visible.

Tomasz


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