the code like this:
JCommander jcommander = new JCommander(arguments);
jcommander.setProgramName(progName);
try {
jcommander.parse(args);
} catch (ParameterException e) {
System.err.println(e.getMessage());
}
but we get exception but cant catch in parse(args) level.
com.beust.jcommander.ParameterException: Only one main parameter allowed but found several: "parameter2" and "script.sh parameter1"
at com.beust.jcommander.JCommander$MainParameter.addValue([JCommander.java:101])
at com.beust.jcommander.JCommander.parseValues([JCommander.java:782])
at com.beust.jcommander.JCommander.parse([JCommander.java:356])
at com.beust.jcommander.JCommander.parse([JCommander.java:335])
the code like this: JCommander jcommander = new JCommander(arguments); jcommander.setProgramName(progName); try { jcommander.parse(args); } catch (ParameterException e) { System.err.println(e.getMessage()); }
but we get exception but cant catch in parse(args) level. com.beust.jcommander.ParameterException: Only one main parameter allowed but found several: "parameter2" and "script.sh parameter1" at com.beust.jcommander.JCommander$MainParameter.addValue([JCommander.java:101]) at com.beust.jcommander.JCommander.parseValues([JCommander.java:782]) at com.beust.jcommander.JCommander.parse([JCommander.java:356]) at com.beust.jcommander.JCommander.parse([JCommander.java:335])