You can also use https://github.com/cemerick/pomegranate - it works fine...

On Wed, Nov 21, 2012 at 5:14 PM, Vladimir Tsichevski
<tsichev...@gmail.com> wrote:
> Hi Yoshinori,
>
> after (unsuccessfully) struggling with Clojure dynamic ClassLoaders in
> clojure-1.4, I ended up with the 'brute force' solution--just add URL
> entries to the Java system classloader. Here is a simple example on how to
> do it from clojure:
>
> (defn add-system-classpath
>   "Add an url path to the system class loader"
>   [url-string]
>   (let [field (aget (.getDeclaredFields java.net.URLClassLoader) 0)]
>     (.setAccessible field true)
>     (let [ucp (.get field (ClassLoader/getSystemClassLoader))]
>       (.addURL ucp (java.net.URL. url-string)))))
>
> (add-system-classpath "file:/some/clojure/root/")
> (load "some/clojure/file") ;; load the some/clojure/file.clj from the
> /some/clojure/root/ catalog
> (add-system-classpath "file:/some/java/classes/")
> some.java.MyClass ;; use the some.java.MyClass in the /some/java/classes/
> catalog
>
> Regards,
> Vladimir
>
> --
> 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



-- 
With best wishes,                    Alex Ott
http://alexott.net/
Twitter: alexott_en (English), alexott (Russian)
Skype: alex.ott

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