Markus said:
I created a URLClassLoader which can load JARs from a given URL.
But the calsses inside the Jars are not be found.
Is there a possibiliy to merge the default ClassLoader with my own one?
I am not entirely sure what you are trying to get at here.
The default behaviour of class loaders is to try to load classes from
the parent class loader first. If a class loader has duplicate classes
available, they will not be loaded. (There are some variations on this.
Web app servers should link webapp classes in preference to common
classes, so as to allow different versions of a library to be used
within the same JVM instance.)
If classes reference other classes that are only available from a child
class loader, than that clearly isn't going to work. How would the code
know, for instance, whether another child class loader will be created
in the future.
Classes with different class loaders can interact by reflection,
although it isn't very convenient. It's best to put as much as possible
into a common parent.
If you want classes to cyclically link to one another, then you will
need to load those classes by the same class loader.
Tom Hawtin