views:

601

answers:

4

I have used getopt in Python and was hoping there would be something similar in Java.

Please give a reason why your answer is better than the others.

+4  A: 

Commons CLI

Chris Jester-Young
I like this one so far as it was quite easy to get up and running with a simple download. The 50 line demo is all I needed to get started, and I easily found that I could parse POSIX-style or GNU-style.
Liam
this is a horrible answer, Java Simple Argument Parse (JSAP) is a much better library. This is a hideous library and is really deprecated.
fuzzy lollipop
So, how is JSAP better than Commons CLI? The only differences I see are: 1. Extensible type handlers (Commons CLI plans to make them extensible, but currently only a fixed set is supported), 2. ability to default values from configuration files.
Chris Jester-Young
+3  A: 

I use Jewelcli and it's quite good.

You can also find a discussion of different available libraries here.

bernardn
+1  A: 

https://args4j.dev.java.net/ -- has pretty good features PLUS MIT license

anjanb
+1  A: 

Look at Java Simple Argument Parser. Very mature and feature complete argument parser for Java. JSAP

fuzzy lollipop