I found the answer and fixed it and it works!

Yes, *use-context-classloader* is true by default.

But, the context classloader wasn't the right classloader, so I had to
set context classloader to the right classloader, at the right place
before any clojure code is called like this:
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

Whoop!

Found this online which also helped me figure this out:
http://www.assembla.com/spaces/clojure/tickets/260-cannot-load-clojure-classes-from-jar-files-outside-classpath-using-urlclassloader


Mudge



On Jul 5, 4:53 am, Chas Emerick <cemer...@snowtide.com> wrote:
> Clojure does use the context classloader by default for its "root"  
> classloader (on top of which it sometimes creates new  
> DynamicCLassloaders).  This behaviour is controlled by the value of  
> *use-context-classloader*, which is true by default.
>
> I don't have any java web start experience, so I'm afraid I can't  
> provide any further advice.  Anyone else here that does?
>
> - Chas
>
> On Jul 4, 2010, at 6:53 AM, Nick Mudge wrote:
>
> > I am writing a 3rd party module in Clojure for a Java Web Start
> > application written in Java.
>
> > I am using Clojure 1.1.
>
> > I think that my clojure program and clojure.jar are on the classpath
> > and are being loaded because when clojure.jar is not seen on the class
> > path this error results: java.lang.ClassNotFoundException:
> > clojure.lang.IFn
> > I am not getting that error so I think that my clojure program and
> > clojure.jar are seen on the classpath and are being loaded.
>
> > This is the error I am getting:
> > Could not locate clojure/core__init.class or clojure/core.clj on
> > classpath
>
> > I think that clojure uses the system classloader by default. Is this
> > correct? However, according to the Java Web Start documentation, the
> > system classloader doesn't work with Java Web Start:
> >http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq....
>
> > The Java Web Start documentation says that the following classloader
> > should be used:
> > ClassLoader cl = Thread.getCurrent().getContextClassLoader();
>
> > My question is, how do I tell clojure to use this classloader so that
> > clojure can load it's own code?
>
> > --
> > 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
> > Note that posts from new members are moderated - please be patient  
> > with your first post.
> > 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

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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