You need to use Commons CLI (Command-Line Interface) to parse an application’s command-line arguments.
Download Commons CLI 1.0. Following the steps outlined in
Recipt 1.1, download “Commons
CLI 1.0” instead of Commons Lang. The Commons CLI
archive—cli-1.0.zip—
contains a file
named commons-cli-1.0.jar
; place this JAR file
in your classpath, and you are ready to use Commons CLI in your
application.
Commons CLI provides a standard mechanism for parsing command-line
arguments. Contained in the org.apache.commons.cli
package, CLI provides a set of classes that can parse command-line
arguments containing optional arguments, arguments with parameters,
and short and long arguments. As shown in this chapter, CLI also
provides a mechanism for printing out usage information.
For more information about Commons CLI, see the Commons CLI project page (http://jakarta.apache.org/commons/cli).
For C developers, see the getopt and argp in the GNU C Library. For more information, see the section “Parsing Program Arguments” in the GNU C Library manual (http://www.gnu.org/software/libc/manual/html_node/index.html).
18.116.49.247