Hello, I have one question about Runtime.exec(). I am trying to use Runtime.getRuntime.exec() to run another program (e.g. a.exe). But a.exe needs an input file or standard input. Does anyone know how to pass in this input file or standard input? Thank you.
JThomas2002 Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy. Thanks again and we hope to see you around the ranch!!
You can just pass that along as part of your paramanter to the exec command. for example <Code>Runtime.getRuntime().exec("java tmp.java");</Code> Using the second param, you can even specify which directory to exec in. HTH, M
You can use a String array to set the command and the arguments for it: String[] a=new String()[]{"program.exe", "param 1", "param 2"}; Runtime.getRuntime().exec(a); [ July 01, 2002: Message edited by: Juanjo Bazan ]
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
a bit of art, as a gift, the permaculture playing cards