Do I have to get the user to add the directory to their classpath?
Yes and no.
The user has to add the jar-file to the classpath, or a directory containing extracted classes (with their subdirectories).
The classpath is a list of things, which contain classes. That might be jars or directories, but not directories containing jars.
(It took me 15 years to understand that simple thing
)
I don't have an idea of how to restrict the searching to a part of the classpath.
You could create a script to extract all classnames, and tell the user to run it after putting new plugins there:
and search that list. Perhaps the easiest solution.
If it is just the one I specify, how does the object created call other objects in its JAR?
That's the job of the classloader. He will do it.
If all classes are loaded, how do I unload them when a plugin is no longer needed in my application?
Job of the GarbageCollection. Let it do it.