The Sun Package List utility (PackageList) recursively inspects specified directories
to identify Java package names. Any directory that contains a .java
or .class file qualifies as Java package unless one of the command
line options instructs PackageList to ignore that directory.
When run from the command line, PackageList writes the list to System.out,
one per line. When run as a module, it returns a LinkedList object from findPkgs().
PackageList can be set to ignore any directories with a specified name, anywhere
in the hierarchy, using -skipAll. It can also be set to ignore
fully qualified paths, using -skip. For both options, "*"
wildcards can be specified, as defined by the pattern-matching
classes for filenames: Specifier.java class (for -skipAll)
and the PathSpecifier.java class (for -skip).
For a sample command script that identifies the packages in the Java 2 Platform (aka "JDK"), see this file: makeJdkPkgList.
java docutil.PackageList {options} dir1 dir2 ... > package.lstNote:
The list of packages that results is suitable for use by JavaDoc. Saving the list to a file gives you the option of using the JavaDoc command: "javadoc ... @package.lst". (The "@" before the filename tells JavaDoc to process it as a list of packages.)
-skipAll name1:name2:...
-skip pkg1:pkg2:...where:
- -skipAll designates a list of directory names to be skipped at any level of the hierarchy where they occur
- -skip designates a list of fully-qualified package names to be skipped
- The names and packages listed can be Specifier patterns or PathSpecifer patterns, respectively
- The remaining command line arguments are directory paths to the packages
java docutil.PackageList -skipAll SCCS:RCS:CVS -skip x.y.z myDir
In this example, all subdirectories of myDir are recursively inspected. Any that contain a .java or .class file are added to the output list on System.out, except: