Taxonomy of Java Command Line Parser Libraries
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts
templates
.github-config
.gitignore
Readme.md
build.gradle
gradlew
gradlew.bat
java-parsers.json

Readme.md

Java command-line parsing libraries

Link to raw JSON file

The raw .json file is available from this link: https://raw.githubusercontent.com/timtiemens/javacommandlineparser/master/java-parsers.json

Top Ranking Java command-line parsing libraries

  1. JCommander
  2. picocli
  3. args4j
  4. JewelCLI

Alphabetical list of Java command-line parsing libraries

Below is a table showing Java command-line parsing libraries, sorted by name. "Rank" is my rank for the library (1 to 4, or blank). "Annotation" indicates the library uses Java annotations for argument metadata (i.e. "good"). "KeyValue" indicates that the library uses Java map structures to store and access the arguments (i.e. "bad").

Name Rank Lang Annotation KeyValue Notes
Airline java X
argot scala abandoned - see scopt
argparse4j java
argparser java X create individual options, where options are "holders", parse() into the holders
args4j 3 java X field-based, unclear if "--long-Name" is supported
clajr java
cli-parser java
CmdLn java X
Commandline java X
DocOpt.java java X weird String-based approach to defining argument names and help at the same time. port of docopt.
dolphin getopt java
DPML CLI java Jakarta Commons CLI2 fork
Dr. Matthias Laux java
Jakarta Commons CLI java X like JArgs, except key is "String", not an Option object
jargo java X
jargp java
JArgs java X single "parse" call with array of options, key is an Option object
java-getopt java
jbock java X
JCLAP java
jcmdline java
JCommander 1 java X good documentation, custom parser, validation
JCommando java generates .java, but still requires an additional .jar
JewelCLI 4 java X interface-based but can be instance-based with setters
JOpt simple java X
JSAP java X old (2008) not well documented
naturalcli java
Object Mentor CLI article dead link java
optional scala multiple github forks
parse-cmd java
picocli 2 java X good documentation - documentation looks suspiciously like it is patterned after JCommander
ritopt java
Rop java
scopt scala
TE-Code Command java

Important Features in Command-Line Parsing Library

  • API uses annotations, not key-value
  • Generates help
  • Short (-v) and Long (--verbose) parsing to same field
  • Sub-commands (git add ...), can have their own options
  • License (i.e. not GPL)
  • Does not depend on other libraries
  • Java version

References