2

Possible Duplicate:
Can you find all classes in a package using reflection?

Hi there. How would I at runtime enumerate all the classes in a package for on the fly code storage and execution?

For example, I make a 'main' package with the main program class in it. At startup of the program it would look for a package named 'bucketofstuff' enumerate the names of all those classes?

Community
  • 1
  • 1
  • 3
    Good question, but it's a duplicate of [Can you find all classes in a package using reflection?](http://stackoverflow.com/questions/520328/can-you-find-all-classes-in-a-package-using-reflection) – Jonathon Faust Jan 27 '11 at 03:04
  • For other meta-information about classes, you can use the [Java Reflection API](http://download.oracle.com/javase/6/docs/technotes/guides/reflection/index.html). That lets you get methods, parameters, etc. – Jonathon Faust Jan 27 '11 at 03:07
  • Thanks. I did not know what I am attempting is called reflection. What about if everything is compiled to class files, make sure it is a 1 class per file? –  Jan 27 '11 at 03:13
  • 1
    The number of classes per file does not matter when using reflection. – Marc W Jan 27 '11 at 03:13
  • Check out some [SO questions related to reflection](http://stackoverflow.com/search?q=java+reflection) to see some examples of what people do with it. – Jonathon Faust Jan 27 '11 at 03:16

0 Answers0