i want to execute an EXE-file in a JAVA-Program.
It works fine, but i want the output of the EXE immediately in a textArea of my JAVA-Program.
Currently i get the output after the "ping"-Command has finished completely (so the JAVA-program hangs for about 3 seconds). But i want to have the result immediately...
What am i doing wrong?
ProcessBuilder pb = new ProcessBuilder().command("C:\\Windows\\SysWOW64\\PING.EXE", "127.0.0.1");
pb.redirectErrorStream(true);
Process process = pb.start();
InputStream processStdOutput = process.getInputStream();
Reader r = new InputStreamReader(processStdOutput);
BufferedReader br = new BufferedReader(r);
String line;
while ((line = br.readLine()) != null) {
// System.out.println(line); // the output is here
textArea.append(line);
}
commando backwards.
Well i want to use this program: https://iperf.fr/iperf-download.php
Output looks like:
Connecting to host 10.1.100.34, port 5201
[ 4] local 172.16.12.33 port 63802 connected to 10.1.100.34 port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 112 MBytes 944 Mbits/sec
[ 4] 1.00-2.00 sec 112 MBytes 944 Mbits/sec
[ 4] 2.00-3.00 sec 112 MBytes 944 Mbits/sec
[ 4] 3.00-4.00 sec 112 MBytes 940 Mbits/sec
[ 4] 4.00-5.00 sec 112 MBytes 944 Mbits/sec
[ 4] 5.00-6.00 sec 112 MBytes 944 Mbits/sec
[ 4] 6.00-7.00 sec 112 MBytes 940 Mbits/sec
[ 4] 7.00-8.00 sec 112 MBytes 944 Mbits/sec
[ 4] 8.00-9.00 sec 112 MBytes 940 Mbits/sec
[ 4] 9.00-10.00 sec 112 MBytes 944 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-10.00 sec 1.10 GBytes 942 Mbits/sec sender
[ 4] 0.00-10.00 sec 1.10 GBytes 942 Mbits/sec receiver
iperf Done.
Still i only get this complete output after iperf has run. If i debug, i get the lines (line by line). So there might be another problem...