import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; /** * 对命令行处理的一个开源包 */ public class Test { public static void main(String[] args) { try { Options opts = new Options(); opts.addOption("h", false, "Print help for this application"); opts.addOption("u", true, "The username to use"); opts.addOption("dsn", true, "The data source to use"); BasicParser parser = new BasicParser(); CommandLine cl = parser.parse(opts, args); //可以在IDE中运行时,传 "-h" if (cl.hasOption('h')) { HelpFormatter hf = new HelpFormatter(); hf.printHelp("OptionsTip", opts); } else { //可以在IDE中运行,传 "-u AAA -dsn BBB" System.out.println(cl.getOptionValue("u")); System.out.println(cl.getOptionValue("dsn")); } } catch (ParseException pe) { pe.printStackTrace(); } } }
相关推荐
Apache Commons CLI提供了一个简单的API,用于呈现,处理和验证命令行界面。 文献资料 可以在上找到更多信息。 可以浏览 。 与Apache Commons CLI的使用有关的问题应张贴到。 在哪里可以获得最新版本? 您可以从...
Apache Commons官网jar包,包含io,cli,codec,net,lang,email等等等等
由于ALevin的配置要求Apache commons CLI 1.2 或更新版本,为了方便大家的交流学习,在此分享目前最新的一个版本如果需要其版本请到https://commons.apache.org/proper/commons-cli/进行下载,下载完成后将他放到lib...
apache commons all 中文api合集
apache commons jar(commons所有的jar包... apache-sanselan-incubating-0.97-bin bcel-5.2 commons-beanutils-1.9.2-bin commons-chain-1.2-bin commons-cli-1.3.1-bin commons-codec-1.10-bin commons-collections4-4
java_easy_cli Apache Commons CLI 的简单包装器 Apache Commons CLI 的简单包装器
commons-lang3.3.1.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。为JRE5.0+的更好的版本所提供 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE....
apache Commons Lang 2.4 API apache Commons Lang 2.4 API
commons-lang3.3.1.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。为JRE5.0+的更好的版本所提供 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE....
Apache Commons Collections,commons-collections-3.2.1和commons-collections4-4.0,含jar包及源码和api文档。
主要介绍了Apache Commons Math3探索之多项式曲线拟合实现代码,小编觉得挺不错的,这里分享给大家,供需要的朋友参考。
Apache Commons API简介,主要介绍Apache Commons API所包含的包,后续更新补充各类的简介和使用方法
Apache Commons是一个非常有用的工具包,解决各种实际的通用问题。(附件中提供了该工具包的jar包,及源文件以供研究) BeanUtils Commons-BeanUtils 提供对 Java 反射和自省API的包装 Betwixt Betwixt提供将 ...
org.apache.commons相关的所以jar包,包括commons-beanutils-1.8.0-bin.zip;commons-betwixt-0.8.zip;commons-cli-1.1.zip;commons-codec-1.3.zip;commons-collections-3.2.1-bin.zip;commons-digester-1.8.zip...
apache-commons下全部官方源码和官方API文档,其中有: commons-beanutils-1.8.0 commons-codec commons-collections commons-dbcp commons-dbutils commons-fileupload commons-io commons-lang commons-lang3 ...
Commons-beanutils-API Commons-collections-API Commons-configuration-API Commons-lang-API Commons-logging-API Dom4j_API java api javascript Struts API J2EE API
apache commons 工具包中提供的一个针对配置文件动态修改的工具类
Apache Commons IO 2.5 (要求 JDK 1.6),IOUtils,FileUtils,jar包下载
赠送jar包:commons-cli-1.3.jar; 赠送原API文档:commons-cli-1.3-javadoc.jar; 赠送源代码:commons-cli-1.3-sources.jar; 赠送Maven依赖信息文件:commons-cli-1.3.pom; 包含翻译后的API文档:commons-cli-...
Apache Commons Logging 1.2