aspose file tools*
The moose likes Java in General and the fly likes How to iterate a package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to iterate a package?" Watch "How to iterate a package?" New topic
Author

How to iterate a package?

Ning Du
Greenhorn

Joined: Apr 23, 2004
Posts: 4
Hi all,

I need to investigate every class in certain a package. How can I get all the classses in a package?

Any reply will be appreciated!!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Generally, you can't, as far as I know.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You can iterate classes in a jar or a directory pretty easily, but that won't necessarily get you every class in a package because multiple jars or file systems could contain classes with the same package path.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ning Du
Greenhorn

Joined: Apr 23, 2004
Posts: 4
Anybody knows about how the code assist is implemented in Eclipse? As you know, when you type a package name in Java editor and type "." , after a while all the classes in this package will be listed.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
One way or another in Eclipse you have set a classpath to a bunch of jars and directories. I'd bet it iterates those to see what's out there. It knows what is in your open projects, too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to iterate a package?