How to get list of classes from a package

David M. Lloyd david.lloyd at redhat.com
Mon Feb 16 17:12:54 UTC 2009


On 02/16/2009 10:22 AM, Ulf Zibis wrote:
> Hi all,
> 
> can anybody tell me, how I could get al list or enumeration of the 
> classes, which belong to a package.
> I can't see any appropriate method in java.lang.Package :-(

This isn't really possible at run time, since one doesn't know whether a 
class exists until one tries to load it.  The classloader might not even 
know.  Also, a package can span classloaders, adding more complexity to the 
problem.

- DML




More information about the core-libs-dev mailing list