private String getProcessId(OptionsAndArgs pOpts) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
        if (pOpts.getPid() != null) {
            return pOpts.getPid();
        } else if (pOpts.getProcessPattern() != null) {
            return findProcess(pOpts.getProcessPattern()).getId();
        } else {
            throw new IllegalArgumentException("No process ID and no process name pattern given");
        }
    }
private String getProcessId ( OptionsAndArgs pOpts ) throws InvocationTargetException , NoSuchMethodException , IllegalAccessException { if ( pOpts . getPid ( ) != null ) { return pOpts . getPid ( ) ; } else if ( pOpts . getProcessPattern ( ) != null ) { return findProcess ( pOpts . getProcessPattern ( ) ) . getId ( ) ; } else { throw new IllegalArgumentException ( "No process ID and no process name pattern given" ) ; } }
Get the process id, either directly from option's ID or by looking up a regular expression for java process name
(but not this java process)

@param pOpts used to get eithe the process Id ({@link OptionsAndArgs#getPid()} or the pattern for matching a
process name ({@link OptionsAndArgs#getProcessPattern()})
@return the numeric id as string
@throws IllegalArgumentException if a pattern is used and no or more than one process name matches.