frazman
frazman

Reputation: 33263

Different argument types

I have a question on design implementation. So, there are two ways to run the program.

  1. pass input , output directory thru command line
  2. or read from config file (in this case I pass the argument of config file thru command line)
  3. If no arguments is passed throw error

As of now, I have been working with args[0], args[1]...

Is there a way (I am sure there is), so that I can pass flag (like --input --output etc) as arguments in java.

Any suggestions on design implementation?

Upvotes: 0

Views: 79

Answers (2)

Helio Santos
Helio Santos

Reputation: 6805

Yet another (simple) alternative

http://www.martiansoftware.com/jsap/

Upvotes: 1

Mik378
Mik378

Reputation: 22181

You can use this apache library focused on your requirement:

http://commons.apache.org/cli/usage.html

Thus, you will be able to avoid using poor args table.

Upvotes: 3

Related Questions