You can't do this elegantly.
Basically a classloader can be asked to load a specific class name, but can't be asked for all the classes it could load. (In the case of something loading classes over the web, it may not be feasible to do so - you can't reliably ask the web server to tell you all the files under a particular directory.)
If your classpath only deals with the file system, you could painfully find all the jar files in extension directories, recurse down normal classpath directories, and look inside all explicitly specified jar files - but it'll be tricky and probably fragile too.