Options options = new Options();
CommandLineParser parser = new DefaultParser();
try {
CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption("help")) {
}
if (cmd.hasOption("verbose")) {
}
String filePath = cmd.getOptionValue("file");
} catch (ParseException e) {
}
HelpFormatter formatter = new HelpFormatter();
String[] remainingArgs = cmd.getArgs();
options.addOption(OptionBuilder.withLongOpt("file")
.hasArg()
.isRequired()
.create("f"));