Prasad S Deshpande
Prasad S Deshpande

Reputation: 1412

is there any function in java which behaves like getopt from c

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.

Upvotes: 17

Views: 13502

Answers (1)

Stefan Ferstl
Stefan Ferstl

Reputation: 5265

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.

Upvotes: 14

Related Questions