I'm currently creating a Process
to run a script from my jar file using the following code:
Process p = Runtime.getRuntime().exec("...");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
// Read the output from the command
String s;
while ((s = stdInput.readLine()) != null) {
if(s.equals("success")) {
return true;
}
}
However when I press a button in my GUI which calls this code, the program freezes until the process output returns success
. How could I stop the program from freezing? I plan on showing a GUI to display the time taken (live) while the process is being executed.