Re: Command-line arg
- From: Mark Space <markspace@xxxxxxxxxxxxxx>
- Date: Fri, 19 Oct 2007 12:19:15 -0700
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/
.
- Follow-Ups:
- Re: Command-line arg
- From: Wayne
- Re: Command-line arg
- References:
- Command-line arg
- From: joe
- Re: Command-line arg
- From: Wayne
- Command-line arg
- Prev by Date: why people use "Map m= new HashMap()" or "List l = new ArrayList()"?
- Next by Date: Re: Application Scoped Object in Web Service
- Previous by thread: Re: Command-line arg
- Next by thread: Re: Command-line arg
- Index(es):