0

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();
    }
}
}
Community
  • 1
  • 1
  • Your shell script probably doesn't write lines to its stdout. What does it do? – JB Nizet Dec 03 '16 at 09:43
  • I only find results which do it like i.. –  Dec 03 '16 at 09:45
  • JB Nize It runs a python Script. –  Dec 03 '16 at 09:45
  • Welcome to Stack Overflow! Please review our [SO Question Checklist](http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist) to help you to ask a good question, and thus get a good answer. – Joe C Dec 03 '16 at 09:47
  • 1
    this might help http://stackoverflow.com/questions/3643939/java-process-with-input-output-stream – nandsito Dec 03 '16 at 12:10

0 Answers0