protected static CommandLine parse_args(String[] args) {		
		CommandLineParser parser = new PosixParser();
		Options opts = new Options();
		opts.addOption(new Option("a", false, "enable all cox optimization"));
		opts.addOption(new Option("s", false, "use strict mode: all the keywords must be matched"));
		
		opts.addOption(new Option("q", true,  "query string to find the parameter"));
		opts.addOption(new Option("i", true,  "the path of the indexes"));
		opts.addOption(new Option("f", true,  "the path of the input file (containing the queries)"));
		opts.addOption(new Option("o", true,  "the path of the output file (results)"));
		opts.addOption(new Option("x", true,  "the path of the filter file (containing parameters not to expose to users"));
		
		try {
			CommandLine cmd = parser.parse(opts, args);
			
			if (cmd.hasOption("i") == false) {
				System.out.println("index path is required!");
				HelpFormatter formatter = new HelpFormatter();
				formatter.printHelp("ant", opts);
				System.exit(-1);
			}
			
			if (cmd.hasOption("o") == false) {
				System.out.println("you are required to set an output file. Sorry fot this.");
				HelpFormatter formatter = new HelpFormatter();
				formatter.printHelp("ant", opts);
				System.exit(-1);
			}
			
			if (cmd.hasOption("f") == false && cmd.hasOption("q") == false) {
				System.out.println("Either a query string is required or an input file is required!");
				HelpFormatter formatter = new HelpFormatter();
				formatter.printHelp("ant", opts);
				System.exit(-1);
				
			} else if(cmd.hasOption("f") == true && cmd.hasOption("q") == true) {
				System.out.println("Please only specify one input method!");
				HelpFormatter formatter = new HelpFormatter();
				formatter.printHelp("ant", opts);
				System.exit(-1);
			}
			
			return cmd;

		} catch (org.apache.commons.cli.ParseException e) {
			System.out.println("unexpected exception in parse_args(): " + e.getLocalizedMessage());
			return null;
		}
	}