37

What CLI parser for Java is easy to use and more scalable than others?

Tom
  • 16,842
  • 17
  • 45
  • 54
Max
  • 2,293
  • 5
  • 32
  • 48

3 Answers3

62

Here are some of the most popular. They are all pretty feature complete, and having used the top two I can recommend them.

EDIT: For completeness, here are some others I've come across

Remko Popma
  • 35,130
  • 11
  • 92
  • 114
user86614
  • 1,420
  • 13
  • 7
  • 2
    Thx. Now i'll use the Commons CLI, because i like Appache's products – Max Oct 06 '09 at 10:14
  • 1
    Good choice. You can always rely on Apache Commons to be rock solid implementations. – user86614 Oct 06 '09 at 10:54
  • The best implementation is **Jargs** at https://github.com/purcell/jargs Straightforward, logical, not bloaded with 1 file & 600 SLOC. Easy to get the remaining args too: String[] otherArgs = parser.getRemainingArgs(); – Nadir Feb 03 '15 at 14:48
  • 2
    You can also find libraries tagged with "Command Line Parsers" in [mvnrepository.com](http://mvnrepository.com/open-source/command-line-parsers) – Guillaume Husta Nov 09 '15 at 14:08
4

JLine is a library for building shell-like applications in Java.

Since 2002, the project was hosted on SourceForge.net and last release was JLine-1.0 on April 2011.

But in 2009, the project has started the migration to GitHub.com and has released the series 2.x since November 2009 (version 2.0). Last version 2.x when writing this answer is 2.14.2 in May 2016.

In October 2016, a new series 3.x has been released.

oHo
  • 51,447
  • 27
  • 165
  • 200
Gregory Mostizky
  • 7,231
  • 1
  • 26
  • 29
3

I don't think scalability is a factor here. you want something which is feature complete and easy to use. I mostly use jargs but I generally dislike it's API (using it out of habit).

you can also try java getopt impl, which I did not personally used.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87
  • I remember when we used JArgs we wrote our own interface to wrap around its API. It worked fine but wasn't as easy to use as it might have been. – David Webb Oct 06 '09 at 11:03