Runtime rt=Runtime.getRuntime(); 
Process x= rt.exec("ls -l"); 
BufferedReader stdInput = new BufferedReader(new InputStreamReader(x.getInputStream())); 
String s; 
while ((s = stdInput.readLine()) != null) { 
  System.out.println(s); 
}