I am looking to print out all classes in all of the packages in my Java project. For example, say the project contained
Package1.Class1
Package1.Class2
Package1.Class3
Package2.Class1
Package2.Class2
I would want to print out all of these packages and classes. Using the following code, I am able to list them, but only when I reference in the manner of Package.Class c = new Package.Class();
Here is the code I am trying to use:
Package[] pa = Package.getPackages();
for (int i = 0; i < pa.length; i++) {
Package p = pa[i];
System.out.print("\"" + p.getName() + "\", ");
}
Any thoughts on how I can do this?
Thanks all