All pastes #965331 Raw Edit

Anonymous

public text v1 · immutable
#965331 ·published 2008-03-31 22:34 UTC
rendered paste body
Process cmdProc = null; 
try {          
  cmdProc = Runtime.getRuntime().exec(cmd); 
} catch (IOException e) {          
  throw new RuntimeException(e); 
} 
BufferedReader in = new BufferedReader(new InputStreamReader(cmdProc.getInputStream())); 
StringBuilder output = new StringBuilder(); 
String line; 
try {   
  while((line = in.readLine()) != null) {     
    output.append(line);     
    output.append("\n");   
  } 
} catch (IOException e) {   
  throw new RuntimeException(e); 
} 
return output.toString();