Parsing command line arguments — JSAP

Although today web and rich client applications are in mostly, sometimes you end up creating a simple command line tool which does not need any graphical user interface (perhaps developing the UI costs you more time than writing the application itself). And to enable configuration of your application you are likely to add command line arguments. If you want the input to be more elastic you can add named (or qualified) arguments but parsing them would be an extra utility.

For this I’ll introduce a new article series in two parts about Java command line argument parsers. In the first article (so this one) I’ll have a look at JSAP from Martian Software, in the second I’ll introduce Commons CLI from Apache. Both of the tools is old (last update from JSAP was in 2006, from CLI in 2009). This is because there is not much about releasing newer version for command line argument parsing because once done there are rarely changes how the argument should be parsed.

Continue reading