A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Runtime.getRuntime() execute script which asks for input from user.
Joined: Jul 30, 2005
Feb 06, 2008 03:00:00
I have to run script on Unix which after execution asks for input from the user, this is done 4-5 times. After every input the user presses the enter key.
How do I implement this using Runtime get Runtime() in my Java application?
Joined: Mar 22, 2005
Feb 06, 2008 03:55:00
First of all, you should get familiar with how Runtime.exec deals with the input and output of the processes it starts.
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 ]
Ping & DNS, my free Android app for network diagnostics
Joined: Sep 17, 2006
Feb 06, 2008 04:02:00
BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter input.");
Whatever the user keystrokes shows up in the variable input.
"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
subject: Runtime.getRuntime() execute script which asks for input from user.
hOW CAN I SEND AN SMS
IP address retrieved from web form submit
how to call shell script(interactive) from java code
Using Ant to run a standalone application
download indicator for file download
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013