List all subpackages of a package

lflame

New Member
I am looking for a way to list all the subpackages of an arbitrary package in Java. Something like this:\[code\]Package basePackage = getPackage("com.mypackage");for(Package subPackage : basepackage.getSubPackages()){ System.out.println(subPackage.getName());}\[/code\]Is there a way to do it? Thanks in advance.How does IDE(let's say Netbeans) do it?
UiovO.png
 
Top