public static void main(String[] args) throws Exception { String command = "echo"; Process child = Runtime.getRuntime().exec(command); InputStream in = child.getInputStream(); int c; while ((c = in.read()) != -1) { System.out.print((char)c); } in.close(); }