Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i get the console output generated by a exe file?

Tags:

java

console

without using a redirect to file (">", ">>")


1 Answers

Process p = Runtime.getRuntime().exec("executable.exec");

BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));

String line;
while ((line = input.readLine()) != null) {
  System.out.println(line);
}
like image 175
Zed Avatar answered Dec 31 '25 12:12

Zed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!