Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fetch parameters when using the Apache Commons CLI library

I'm using the Apache Commons CLI to handle command line arguments in Java.

I've declared the a and b options and I'm able to access the value using CommandLine.getOptionValue().

Usage: myapp [OPTION] [DIRECTORY]  Options: -a        Option A -b        Option B 

How do I declare and access the DIRECTORY variable?

like image 452
Mridang Agarwalla Avatar asked Jan 14 '11 09:01

Mridang Agarwalla


1 Answers

Use the following method:

CommandLine.getArgList() 

which returns whatever's left after options have been processed.

like image 145
Jim Garrison Avatar answered Sep 29 '22 18:09

Jim Garrison