public static String exec(String command) {
StringBuilder sb = new StringBuilder();
try {
Process exec = Runtime.getRuntime().exec(command);
exec.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
String tmp = null;
while ((tmp = br.readLine()) != null) {
sb.append(tmp);
}
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
return sb.toString();
}