Loop doesn t start printing until i m closing the program.I tried everything to bring it working but nothing helps. The Shell script is running a python Script which prints in line format. This (Java Process with Input/Output Stream) post is a completely different theme.
package de.ye.car_gps;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class GET_SEND_GPS implements Runnable{
@Override
public void run() {
try {
ProcessBuilder pb = new ProcessBuilder("/home/pi/st_gps.sh");
Process p = pb.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while (true) {
line = reader.readLine();
System.out.println(line);
THREAD_GPS.writer.println(line);
THREAD_GPS.writer.flush();
}
} catch (IOException e){
e.printStackTrace();
}
}
}