> But I would like to create a Class Browser that shows all classes that
> are available in the system. Is this possible? If it is, how?
You need to navigate System.getProperty("java.class.path") and the
bootclasspath. Look in every jar, directory etc. - recursively - and
analyze .class files. Remember to "convert" nested classes (they have
a $ in their names).
John C. Bollinger - 29 Apr 2005 18:10 GMT
>>But I would like to create a Class Browser that shows all classes that
>>are available in the system. Is this possible? If it is, how?
[quoted text clipped - 3 lines]
> analyze .class files. Remember to "convert" nested classes (they have
> a $ in their names).
And you must recognize that the classes you discover this way are not
the only ones that an application running on the system might be able to
load. An application may include any number of its own classes or
external libraries that come from locations not on the default
classpath. You might not find all these even if you were to run your
class browser from within the application in question. You certainly
will never find classes that an application might load over a network,
or from a database, or those that an application might synthesize at
runtime.
In general, it is impossible to find "all classes available in the
system", but if you narrow the scope (to classes available via the class
browser's own classpath, for instance) then you can achieve the goal.

Signature
John Bollinger
jobollin@indiana.edu
> I'm currently writing a Java-Application that is supposed to offer a
> sort of Class Browser (similar to the Smalltalk Class Browser).
[quoted text clipped - 3 lines]
> But I would like to create a Class Browser that shows all classes that
> are available in the system. Is this possible? If it is, how?
Using reflection it is possible to get a list of all *loaded* classes
from the classloader.
Not nice, but it is possible.