import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class ExecProg { public static void main(String[] args) { Process proc; String befehl = "less /etc/fstab"; Runtime run = Runtime.getRuntime(); InputStream inStr = null; BufferedReader buff = null; try { proc = run.exec(befehl); inStr = proc.getInputStream(); buff = new BufferedReader(new InputStreamReader(inStr)); String str; while ((str = buff.readLine()) != null) { System.out.println(str); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (buff != null) buff.close(); if (inStr != null) inStr.close(); } catch (IOException ioe){} } } }