inputStream = process.getInputStream();
outputStream = process.getOutputStream();
errorStream = process.getErrorStream();
isRunning = true;
} catch (IOException ex) {
throw new ProcessCanNotBeRunException("An I/O error occurs. Process cannot be run: " + ex);
}
timer = new Timer();
timer.schedule(new KillingTimerTask(process), timeLimit + 100); // it will kill the program if time limit exceeded
beginTime = System.currentTimeMillis();
} else {
throw new ProcessCanNotBeRunException("Command to run is null");
}
} else {
throw new ProcessRunningException("Process is already running");
}
}