code: public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException {
      Process p = Runtime.getRuntime().exec(command);
  
      StreamManager sm = new StreamManager();
      try {
        InputStream input = sm.handle(p.getInputStream());
        StringBuffer lines = new StringBuffer();
        String line;
  
        BufferedReader in = (BufferedReader) sm.handle(new BufferedReader(new InputStreamReader(input, encoding)));
        while ((line = in.readLine()) != null) {
          lines.append(line).append('\n');
        }
        return lines.toString();
      } finally {
        sm.closeAll();
      }
    }
docs: Executes a system command with arguments and returns the output.
  
  @param command command to be executed
  @param encoding encoding to be used
  @return command output
  @throws IOException on any error