I have the same problem on my Mac as well, i.e. if clojure.jar is
loaded from ~/Library/Java/Extensions rather than from the classpath,
then clojure does not find files on the classpath.  I did some poking
around and on my Mac OS X 10.5.6 with Java 6.

When I start clojure with clojure.jar only on the CLASSPATH, then the
parent CassLoader of the DynamicClassLoader returned by
clojure.lang.RT.baseLoader() and/or clojure.lang.RT.getRootClassLoader
() is a sun.misc.Launcher$AppClassLoader.  That in turn has a parent
of class sun.misc.Launcher$ExtClassLoader.

When I move clojure.jar to ~/Library/Java/Extensions and restart, then
the parent CassLoader of the DynamicClassLoader is a sun.misc.Launcher
$ExtClassLoader. Its parent is nil. Since the ExtClassLoader handles
loading from extension directories and not from the CLASSPATH as
AppClassLoader does, that would explain why the files aren't being
found on the CLASSPATH in this case.

You can see the differences by using the following in the REPL:

With clojure.jar from the CLASSPATH:

    Clojure
    user=> (. (clojure.lang.RT/baseLoader) getParent)
    #<AppClassLoader sun.misc.launcher$appclassloa...@e47858e>
    user=> ^D

With clojure.jar from an extensions directory:

    Clojure
    user=> (. (clojure.lang.RT/baseLoader) getParent)
    #<ExtClassLoader sun.misc.launcher$extclassloa...@cc7ad6>
    user=> ^D

Same results if getRootClassLoader is used instead of baseLoader.

Don't know if this is Mac-specifc behavior or not.

   - David

On Mar 24, 3:36 pm, Rich <rwml...@gmail.com> wrote:
> I think I figured it out.
>
> If I install clojure.jar into /Library/Java/Extensions/ (the ext
> directory on Macs) then it won't work. Even if I use java -cp ... to
> point to a different clojure.jar. Simply having the jar in that folder
> breaks things.
>
> Once I deleted it from /Library/Java/Extensions, I could manually set
> the class path using java -cp and things worked fine again.
>
> So, at least I have a good work around. But does anyone know why
> placing the jars in the ext directory no longer works? It was my
> understanding that this was the recommended way to install Jars. Does
> placing them in the java.ext.dirs on other systems also cause
> problems? Or is this just a Mac thing?
>
> Thanks everyone for your help.
>
> -Rich-
>


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