public static int executeShellCommand(String command, StringBuilder stderrString) {
        int exitVal = -1;
        try {
            Process proc = Runtime.getRuntime().exec(command);
            InputStream stderr = proc.getErrorStream();
            InputStreamReader isr = new InputStreamReader(stderr);
            BufferedReader br = new BufferedReader(isr);
 
            BufferedWriter processInput = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
             
            
            String line = null;
            while ( (line = br.readLine()) != null) { stderrString.append(line); }
            exitVal = proc.waitFor();
        }
        catch (IOException ex) {
            exitVal = -1;
        }
        catch (InterruptedException ex) {
            exitVal = -1;
        }
        return exitVal;
    }