qualche utile link per correggere il malfunzionamento:
dove mi ha fatto venire in mente che non facevo:
Finally
destroy()
your Process.ma infine utilissimo:
vanno chiusi anche gli stream....
public class ProcDemo {
public static void main(String[] args) throws
InterruptedException, IOException {
Process proc = null;
try {
ProcessBuilder pb = new ProcessBuilder(args);
proc = pb.start();
proc.waitFor();
} finally {
if (proc != null) {
close(proc.getOutputStream());
close(proc.getInputStream());
close(proc.getErrorStream());
proc.destroy();
}
}
}
private static void close(Closeable c) {
if (c != null) {
try {
c.close();
} catch (IOException e) {
// ignored
}
}
}
}
Nessun commento:
Posta un commento