Java构建命令行启动模式CommandLineParser/Options
public void parseArgs(String[] args) throws ParseException { // Create a Parser CommandLineParser parser = new BasicParser( ); Options options = new Options( ); options.addOption( "h" , "help" , false , "Print this usage information" ); options.addOption( "c" , "cfg" , true , "config Absolute Path" ); options.addOption( "l" , "log" , true , "log configuration" ); // Parse the program arguments CommandLine commandLine = parser.parse( options, args ); // Set the appropriate variables based on supplied options if ( commandLine.hasOption( 'h' ) ) { printHelpMessage (); System. exit ( 0 ); } if (