I know you can use use following to run a command for linux in java and get the output from the command you just ran.
Process p = Runtime.getRuntime().exec("host -t a " + domain);
p.waitFor();
StringBuffer sb = new StringBuffer();
BufferedReader reader =
new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
sb.append(line + "\n");
}
I am however wondering, is there any simpler way of getting the output from the command that was ran?
This is the code I use. It
.