* @return
* exit code. 0 if success.
*
*/
public static int run(String[] args, ClassLoader classLoader) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final Options options = new Options();
if (args.length ==0) {
usage();
return -1;
}
for (String arg : args) {
if (arg.equals("-help")) {
usage();
return -1;
}
if (arg.equals("-version")) {
System.out.println(Messages.VERSION.format());
return -1;
}
if (arg.equals("-fullversion")) {
System.out.println(Messages.FULLVERSION.format());
return -1;
}
}
try {
options.parseArguments(args);
} catch (BadCommandLineException e) {
// there was an error in the command line.
// print usage and abort.
System.out.println(e.getMessage());
System.out.println();