Classpathtool Overview


The ClassPathTool utility is intended to allow a user to search class path(s) for a particular Java class file, specified by name. The ClassPathTool is smart enough to handle two special casesfirst, searching for a particular path and file, and second, looking for a matching entry in a JAR or ZIP file. This serves two purposes: first, a user can search an arbitrary directory for a desired class file hidden in an unknown JAR file (for example, if a particular class is referenced by a source file). Second, a user may want to search the current class path to determine if the expected version of the class is actually on the class path. This is increasingly common given the complexity of server-side Java development and the proliferation of popular utility libraries (such as Jakarta Commons).

The ClassPathTool utility, as shown in Figure 13-1, does not actually have a user interface. It is exposed as a simple JavaBean-style library, with properties available to set options and a single getEntries() method to perform the search as configured. There is no reason that the ClassPathTool utility could not have a Swing or even web user interface, but those interfaces may be prohibitive in certain server environments. Therefore, the CommandLineDemo class is provided as a wrapper, making use of Commons CLI.

Figure 13-1. CLI example overview.




    Apache Jakarta Commons(c) Reusable Java Components
    Real World Web Services
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 137
    Authors: Will Iverson

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net