15

Hello I am working on command line application which can accepts command line argument like

app -port 8888 -filename d:\xyz\xyz.pdf -dest d:\pqr

I am looking for function which can return me pair of option and it corresponding value like getopt in c.

BenMorel
  • 31,815
  • 47
  • 169
  • 296
Prasad S Deshpande
  • 1,298
  • 4
  • 14
  • 34
  • 2
    possible duplicate of [Java library for parsing command-line parameters?](http://stackoverflow.com/questions/1200054/java-library-for-parsing-command-line-parameters) – Sean Reilly Aug 03 '12 at 11:57

1 Answers1

12

There are quite a few command line parser libraries for Java out there.

A recent (as of late 2019) command line parser with a lot of momentum and features is picocli.

Some older, popular ones are commons-cli (quite old), args4j and JCommander.

Joachim Sauer
  • 291,719
  • 55
  • 540
  • 600
Stefan Ferstl
  • 4,875
  • 3
  • 29
  • 40