0

How can I recover the result of

Runtime.getRuntime().exec("dir"); 

in JTextArea in java programming language.Best regards;

  • Please refer to [this question](http://stackoverflow.com/a/5711150/1089811). – R.daneel.olivaw Apr 16 '14 at 10:57
  • use the `java streams` to combine the `inputstream` from one to the `outputstream` of other. – Ankit Kumar Apr 16 '14 at 11:08
  • i used these instructions in my code that it returns to me an exception : public static String execCmd(String cmd) throws java.io.IOException { java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } – user3533570 Apr 16 '14 at 13:01

0 Answers0