title: Executing external program in java and passing commands
body: <p>I have this chess engine Rybka.exe, that i have to execute in java
  Here is an example how you run Rybka:
  Once you clicked on it, console opens and waits for input.
  So then you enter "uci" and you press enter and you wait for it to load (approx. 1 sec) and then you have to enter a few more lines as options and stuff.
  The problem is that I don't know how to pass those commands from java to Rybka. The fact is that those commands need to be entered one at a time, because you have to wait for some to execute.
  This is how I tried to open it.
  Code:</p>
  
  <pre><code>Process p1 = Runtime.getRuntime().exec("Rybka.exe");
  </code></pre>
  
  <p>This works, because you can see that Rybka.exe is active in task manager, but I don't know how to pass commands to it.</p>