First of all,
you should get familiar with how Runtime.exec deals with the input and output of the processes it starts.
This article is a very good start.
Then you'll need to think about reading and parsing the input stream. How do you find out when the script is done sending (probably at a line end), and what do you need to send as response?
Does the Java code know how to respond to the script, or must it show the script output to the user, and ask for input from him?
[ February 06, 2008: Message edited by: Ulf Dittmer ]