Are there good Java libraries that facilitate building command-line applications?

carrier picture carrier · Jan 12, 2009 · Viewed 20.9k times · Source

I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters...

UPDATE

Something that has built-in TAB completion would be particularly great.

Answer

Kevin ORourke picture Kevin ORourke · Jan 12, 2009

I've used the Apache Commons CLI library for command-line argument parsing. It's fairly easy to use and has reasonably good documentation.

Which library you choose probably comes down to which style of options you prefer ("--gnu-style" or "-javac-style").