> > http:// > > > forums.sun.com/thread.jspa?threadID=300557&start=0&tstart=0 > > > > > Using a classloader manually is sub-optimal because the rest of > > > Clojure, which doesn't know anything about the user-created > > > classloader, wouldn't use it to load classes; you'd have to use the > > > reflection API yourself to manipulate them. > > > > That's normally true, but if you look at the thread reference above it > shows > > you how to 'hack' the system classloader, so you can use the classes as > if > > they were loaded normally (on JVM startup) > > That's too much of a hack for my tastes, and it will only work for > stand-alone applications (possibly only on certain JVMs).
Yep, it is a total hack. But, that type of hack could be EXTREMELY useful for standalone scripts/apps. It shows that it's possible to load classes or jars at runtime and use the classes just as one expects. Just imagine, adding a line to the top of your clojure script like: (grab org.sourceforge.jtds jtds 1.2.5) and having your script fetch the jtds dependency (if needed) from a Maven repo and load the classes. You could then just ship a Clojure script WITHOUT the dependent jars. I use this type of thing in Groovy (via Grape) all the time. It makes life much simpler and adding a similar 'hack' to Clojure would greatly increase Clojure's usefulness for scripting tasks. -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlin...@gmail.com -- 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