Did you ever get this resolved? I just had the same thing start
happening to me today, after not experiencing any problems with it as
recently as yesterday. (What changed? I tried to install swank.
Nuking swank did not fix the problem, tho.) Step by step:
(add-classpath ...) ; seems to work, because
(seq (.getURLs (clojure.lang.RT/baseLoader))) ; shows the added jar or
directory, and
(Class/forName ...) ; returns a result (no exception), but
(import ...) ; fails with ClassNotFoundException and
(ns (:import ...)) ; also fails
I eventually got my code working again by copying the source of the
import function out of core.clj, renaming it "my-import", and changing
all my import statements to "my-import" statements, accordingly.
Anyway, it makes no sense to me. I'm just hoping someone more
experienced will be able to say what's really going on.
On Dec 9, 7:07 am, "rob.blackwell" <
rob.blackw...@aws.net> wrote:
> When I load a JAR at runtime with add-classpath
>
> (add-classpath "file:///Users/reb/java/jena.jar")
>
> and try
>
> user=> (import '(com.hp.hpl.jena.rdf.model ModelFactory))
>
> I get
>
> java.lang.ClassNotFoundException:
> com.hp.hpl.jena.rdf.model.ModelFactory (NO_SOURCE_FILE:0)
> user=>
>
> However, I can still use the classes if I fully qualify them.
>
> The same import does work if I add the JAR to the classpath when
> invoking java, but that seems to be less flexible.
>
> Am I doing something wrong?
>
> Is this a bug?
>
> Any advice gratefully received!