catch (MissingArgumentException mae) { System.err.println( "Command line parsing failed for " + command + ".  Reason: missing argument " + mae.getMessage() ); System.exit( 1 ); } catch (MissingOptionException moe) { System.err.println( "Command line parsing failed for " + command + ".  Reason: missing option " + moe.getMessage() ); System.exit( 1 ); } catch (UnrecognizedOptionException uoe) { System.err.println( "Command line parsing failed for " + command + ".  Reason: unrecognized option" + uoe.getMessage() ); System.exit( 1 ); } catch (ParseException pe) { System.err.println( "Command line parsing failed for " + command + ".  Reason: " + pe.getClass() ); System.exit( 1 ); }
    public CommandLine getCommandLine( String command, String[] args )    {        Options all = allOptions( command );        CommandLineParser parser = new PosixParser();        CommandLine cmdline = null;        try        {            cmdline = parser.parse( all, args );        }        catch ( ParseException e )        {            System.err.println( "Command line parsing failed for " + command + ".  Reason: " + e.getMessage() );            System.exit( 1 );        }        return cmdline;    }