How do I print to stdout the output string obtained executing a command?
So Runtime.getRuntime().exec()
would return a Process
, and by calling getOutputStream()
, I can obtain the object as follows, but how do I display the content of it to stdout?
OutputStream out = Runtime.getRuntime().exec("ls").getOutputStream();
Thanks