This is more of a comment but a popper answer, but my bad reputation does not allow me to post a comment.
Your process will block if either stdout or stderr overflow their respective buffer size.
Try your command in a shell to see what happens, and start threads to read stdterr and stdout.
Edit: here is what I found on the net, and it works for me when I don't need the content of stdout and stderr, but only the command to run.
I call the dropOutput just before the processCC.waitFor().
private int dropOutput(final Process p) {
final Thread t = new Thread("drop") {
@Override
public void run() {
_dropOutput(p);
};
};
t.start();
int ev = 0;
Timer timer = null;
try {
timer = new Timer(true);
final InterruptTimerTask interrupter = new InterruptTimerTask(Thread.currentThread());
timer.schedule(interrupter, 2 /*seconds*/* 1000 /*milliseconds per second*/);
if (p.waitFor() != 0) {
ev = p.exitValue();
}
} catch (final InterruptedException e) {
// e.printStackTrace();
} finally {
timer.cancel(); // If the process returns within the timeout period, we have to stop the interrupter
// so that it does not unexpectedly interrupt some other code later.
Thread.interrupted(); // We need to clear the interrupt flag on the current thread just in case
// interrupter executed after waitFor had already returned but before timer.cancel
// took effect.
//
// Oh, and there's also Sun bug 6420270 to worry about here.
}
return ev;
}
/**
* Just a simple TimerTask that interrupts the specified thread when run.
*/
class InterruptTimerTask extends TimerTask {
private final Thread thread;
public InterruptTimerTask(final Thread t) {
this.thread = t;
}
@Override
public void run() {
thread.interrupt();
}
}
private void _dropOutput(final Process p) {
final InputStream istrm = p.getInputStream();
// final InputStream istrm = p.getErrorStream();
final InputStreamReader istrmrdr = new InputStreamReader(istrm);
final BufferedReader buffrdr = new BufferedReader(istrmrdr);
@SuppressWarnings("unused")
String data;
try {
while ((data = buffrdr.readLine()) != null) {
// System.out.println(data);
}
} catch (final IOException e) {
// do nothing
}
}