Quantcast
Channel: How do I parse command line arguments in Java? - Stack Overflow
Browsing all 24 articles
Browse latest View live

Answer by Stefan Haberl for How do I parse command line arguments in Java?

If you are already using Spring Boot, argument parsing comes out of the box. If you want to run something after startup, implement the ApplicationRunner interface: @SpringBootApplication public class...

View Article



Answer by Pierluigi Vernetto for How do I parse command line arguments in Java?

For Spring users, we should mention also https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/core/env/SimpleCommandLinePropertySource.html and his twin brother...

View Article

Answer by stevens for How do I parse command line arguments in Java?

As one of the comments mentioned earlier (https://github.com/pcj/google-options) would be a good choice to start with. One thing I want to add-on is: 1) If you run into some parser reflection error,...

View Article

Answer by John Koumarelas for How do I parse command line arguments in Java?

I know most people here are going to find 10 million reasons why they dislike my way, but nevermind. I like to keep things simple, so I just separate the key from the value using a '=' and store them...

View Article

Answer by Trismegistos for How do I parse command line arguments in Java?

Argparse4j is best I have found. It mimics Python's argparse libary which is very convenient and powerful.

View Article


Answer by Himanshu Shekhar for How do I parse command line arguments in Java?

If you want something lightweight (jar size ~ 20 kb) and simple to use, you can try argument-parser. It can be used in most of the use cases, supports specifying arrays in the argument and has no...

View Article

Image may be NSFW.
Clik here to view.

Answer by Remko Popma for How do I parse command line arguments in Java?

It is 2019, time to do better than Commons CLI... :-) Buy or build? Many small utility-like applications probably roll their own command line parsing to avoid the additional external dependency....

View Article

Answer by Paul for How do I parse command line arguments in Java?

This is Google's command line parsing library open-sourced as part of the Bazel project. Personally I think it's the best one out there, and far easier than Apache CLI....

View Article


Answer by cthiebaud for How do I parse command line arguments in Java?

airline @ Github looks good. It is based on annotation and is trying to emulate Git command line structures.

View Article


Answer by Tatsuhiro Tsujikawa for How do I parse command line arguments in Java?

I wrote another one: http://argparse4j.sourceforge.net/ Argparse4j is a command line argument parser library for Java, based on Python's argparse.

View Article

Answer by Jakub for How do I parse command line arguments in Java?

I wouldn't recommend using Apache Common CLI library, as it is non-threadsafe. It uses stateful classes with static variables and methods to do internal work (e.g. OptionBuilder) and should only be...

View Article

Answer by lexicalscope for How do I parse command line arguments in Java?

I have been trying to maintain a list of Java CLI parsers. Airline Active Fork: https://github.com/rvesse/airline argparse4j argparser args4j clajr cli-parser CmdLn Commandline DocOpt.java dolphin...

View Article

Answer by Cedric Beust for How do I parse command line arguments in Java?

Take a look at the more recent JCommander. I created it. I’m happy to receive questions or feature requests.

View Article


Answer by André for How do I parse command line arguments in Java?

Someone pointed me to args4j lately which is annotation based. I really like it!

View Article

Answer by Alex Miller for How do I parse command line arguments in Java?

You might find this meta-article of unhappiness interesting as a jumping off point: http://furiouspurpose.blogspot.com/2008/07/command-line-parsing-libraries-for-java.html

View Article


Answer by Ray Tayek for How do I parse command line arguments in Java?

If you are familiar with gnu getopt, there is a Java port at: http://www.urbanophile.com/arenn/hacking/download.htm. There appears to be a some classes that do this:...

View Article

Answer by OscarRyz for How do I parse command line arguments in Java?

Yeap. I think you're looking for something like this: http://commons.apache.org/cli The Apache Commons CLI library provides an API for processing command line interfaces.

View Article


Answer by GaryF for How do I parse command line arguments in Java?

I've used JOpt and found it quite handy: http://jopt-simple.sourceforge.net/ The front page also provides a list of about 8 alternative libraries, check them out and pick the one that most suits your...

View Article

Answer by mepcotterell for How do I parse command line arguments in Java?

Maybe these JArgs command line option parsing suite for Java - this tiny project provides a convenient, compact, pre-packaged and comprehensively documented suite of command line option parsers for the...

View Article

Answer by Marc Novakowski for How do I parse command line arguments in Java?

Take a look at the Commons CLI project, lots of good stuff in there.

View Article
Browsing all 24 articles
Browse latest View live




Latest Images