I have a series of folders that contain JAR files, these JARs act as plugins for my main application. Each seperate folder of JARs is loaded with its own classloader, so that that folder of JARs can be loaded and unloaded independantly of other folders.
Some JARs have dependencies on other JARS. In several cases there are multiple JARs (Say, Set A) that have a dependency on the same seperate JAR (Lets call it BaseJar). For this reason I have a seperate folder for this BaseJar, so that I can just load it the once and not have multiple places where the JAR could exist.
I need to provide the functionality where any one of these sets of JARs could be disabled, and then reloaded. So that any small updates to these plugins can be done on the fly without having to disable the entire application. This leads me to the question in my title. If I were to unload this BaseJar class, so that it could be updated, is there a way to avoid then having to unload and reload all of the SetA JARs as well? I would like them to be able to continue to operate as normal as soon as their new dependency has been loaded by the seperate class loader.
EDIT: To clarify my position, after some answers have been given, I already have a working custom JarClassLoader. At present I can load up all of my plugins and unload them all just fine. I need to know whether it's possible for me to load and unload in batches, without affecting other JARs that may use some class contained in another JAR which gets upgraded at runtime.
I'm aware there may be issues if I attempted to use that plugin during the upgrade process, where the class it's attempting to use is no longer loaded by the JVM and therefore unavailable until the newer version has been loaded. It's just after this new class has been uploaded, will it possibly lead resolution problems?