Re: Command-line arg



Wayne wrote:

...
if ( arg.length > 0 ) {
... // do something with arg[0]
}

or:
...
if ( arg.length == 0 ) {
// do error handling here
return;
}


It is theoretically possible for main() to be called with a null argument. You may wish to check for this also or risk throwing a NullPointer exception.

I was just at the Apache Commons project yesterday thanks to a pointer from someone here on this newsgroup. Check out CLI, a generic command line parser:

http://commons.apache.org/cli/
.