public static boolean check(String[] checkCmd, int... errorValue) {
        if (errorValue.length == 0) {
            errorValue = new int[]{127};
        }

        try {
            Process process;
            if (checkCmd.length == 1) {
                process = Runtime.getRuntime().exec(checkCmd[0]);
            } else {
                process = Runtime.getRuntime().exec(checkCmd);
            }
            int result = process.waitFor();

            for (int err : errorValue) {
                if (result == err) {
                    return false;
                }
            }
            return true;
        } catch (IOException | InterruptedException e) {
            // Some problem, command is there or is broken
            return false;
        }
    }
Checks to see if the command can be run. Typically used with something
like "myapp --version" to check to see if "myapp" is installed and on the
path.

@param checkCmd   the check command to run
@param errorValue what is considered an error value?
@return whether or not the check completed without error
tika-core/src/main/java/org/apache/tika/embedder/ExternalEmbedder.java