As part of a larger application, I am creating an executer which lists classes and methods and let the user provide their parameters for on-the-fly execution.
Now, It is possible to list all packages by using dummy statements from each major package and "Package.getPackages()" will list related packages for you. But it is a bit tedious.
Now, listing pakage classes !!! I have no idea
> Now, It is possible to list all packages by using
> dummy statements from each major package and
> "Package.getPackages()" will list related packages
> for you. But it is a bit tedious.
What do you mean?
> Now, listing pakage classes !!! I have no idea
As I said, it can't be done since you can load classes dynamically from any location.
Kaj
> What do you mean?
if you run a very simple class that does not extend any JDK class, Package.getPackages() returns some 20 packages.However, if you extend javax.swing.JFrame for example, Package.getPackages() will return some 40 packages, and so on.
> As I said, it can't be done since you can load
> classes dynamically from any location.
Then how NetBeans (for example) lists all packages and their classes ?
> Then how NetBeans (for example) lists all packages
> and their classes ?
You have in that case speficied the classpath for the project so NetBeans knows here to look. It will scan the jars, and folders that you have specified and list he classes. It will not be able to list any classes that you are loading dynamically unless you have them on the classpath.
Kaj