我想试用 Apache Commons CLI,并想从其网页上的“使用”部分开始。
http://commons.apache.org/proper/commons-cli/usage.html
现在,该示例建议创建一个 DefaultParser
,但我能找到的最接近的声音是 BasicParser
。这是要使用的东西吗,我错过了什么吗?
最佳答案
我使用 GnuParser()
而不是 DefaultParser()
并且效果很好。
CommandLineParser parser = new GnuParser();
更新:在 CLI 版本 1.3.1 中,GnuParser()
现在已弃用。所以我简单地添加了 import org.apache.commons.cli.DefaultParser;
现在我使用 CommandLineParser parser = new DefaultParser ();
一切都很好!
关于java - Apache Commons CLI 中的 DefaultParser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15732696/