/**
* wrapper for Runtime.exec.
* No input/output. Optionally wait for child to finish.
* @param command fully qualified *.exe or *.com command
* @param wait true if you want to wait for the child to finish.
*/
public static Process exec ( String command, boolean wait )
{
Process p;
try
{
p = Runtime.getRuntime().exec( command );
}
catch ( IOException e )
{
return null;
}
if ( wait )
{
try
{
p.waitFor();
}
catch ( InterruptedException e )
{
Thread.currentThread().interrupt();
}
}
p.getInputStream().close();
p.getOutputStream().close();
p.getErrorStream().close();
return p;
}