// execute command
String [] cmdArray = cmd.toArray(new String[] {});
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmdArray, null, destination);
StreamGobbler errGobbler = new StreamGobbler(logger, proc.getErrorStream(), "Unrar (Error)");
StreamGobbler outGobbler = new StreamGobbler(logger, proc.getInputStream(), "Unrar");
// fetch command's STDOUT and STDERR
errGobbler.start();
outGobbler.start();
// wait until program has finished
int exitVal = proc.waitFor();
logger.msg("Unrar command exit value: " + exitVal, MyLogger.SEV_INFO);
// get RAR archive part file names
for(String line : outGobbler.getLines())
{
String l = line.trim();
if(l.startsWith("Extracting from "))
rarPartFiles.add(l.substring(16));
}