Class loading from different folder

I want to load classes from a different project directory. Suppose I have to load the classes from "/home/bin/classes" folder along with the current classes that jvm loaded initially

Can you help?

[209 byte] By [mammaa] at [2007-11-27 11:56:04]
# 1

Depends. You can specify the jars in that other folder as part of the classpath when you start your app, but I'm guessing since you asked, that you want to do this after your app. has loaded. If that's the case, you should read the documentation for URLClassLoader. It's probably what you're looking for

georgemca at 2007-7-29 19:05:31 > top of Java-index,Core,Core APIs...
# 2

> I want to load classes from a different project

> directory. Suppose I have to load the classes from

> "/home/bin/classes" folder along with the current

> classes that jvm loaded initially

>

> Can you help?

Easiest, though not so pretty way of doing that is like mentioned in this post:

http://forum.java.sun.com/thread.jspa?threadID=759542&messageID=4337079

(using reflection to make the protected method addURL available)

Other way is to write your own URLClassloader to load your classes. You need to access them using reflection or interfaces that way though.

_thijsa at 2007-7-29 19:05:31 > top of Java-index,Core,Core APIs...