Hi everyone. I m having trouble in a java program. i am trying to execute bash script through a java GUI program in linux. current coding which i am using can actually perform the job but it hangs whenever i press the button. I have to terminate the program through NetBeans IDE stop process. What should I do?
This is the code which i am using..
try {
Process proc = Runtime.getRuntime().exec("/home/user/Desktop/sources_files/script2.sh /");
BufferedReader read = new BufferedReader(new InputStreamReader(
proc.getInputStream()));
try {
proc.waitFor();
} catch (InterruptedException e) {
System.out.println(e.getMessage());
}
while (read.ready()) {
System.out.println(read.readLine());
}
} catch (IOException e) {
System.out.println(e.getMessage());
}