本文介绍了使用Apache Commons CLI库时如何获取参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Apache Commons CLI来处理Java中的命令行参数。
I'm using the Apache Commons CLI to handle command line arguments in Java.
我已声明 a 和 b 选项,我可以使用 CommandLine.getOptionValue()来访问该值。
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如何声明和访问DIRECTORY变量?
How do I declare and access the DIRECTORY variable?
推荐答案使用以下方法:
CommandLine.getArgList()返回处理选项后剩余的内容。
which returns whatever's left after options have been processed.
更多推荐
使用Apache Commons CLI库时如何获取参数
发布评论