Advanced command line argument parsing in Java?

Posted by Bishop87 on Stack Overflow See other posts from Stack Overflow or by Bishop87
Published on 2010-03-17T18:32:07Z Indexed on 2010/03/17 18:41 UTC
Read the original article Hit count: 337

Does anyone have any java examples for parsing a series of command line arguements in a robust way?

I'm looking to be able to handle something like:

java myapp [-l language] [-d int] [-f file1 file2 file3]

I want to do this in a robust way so I can provide logical error messages to the user if they mistake a command line-option. Some of these options I'd like to make optional, etc, etc. Also, the -f file list should be able to handle a list of files.

Is there some library out there to assist me in handling this?

© Stack Overflow or respective owner

Related posts about java

Related posts about command-line