Thank you for re-directing me to this article. I came across with it before and for some reason when i try to use the waitFor method it takes forever for the exit value to come back which indicates that I can run the next command in a sequential manner.
Any ideas how this could be accelerated or if known workaround. I need to telnet to switches and if I have to wait sunch a long time for the the username and password prompt it will be too long of a wait for my program to be efficient.
Joined: Nov 04, 2009
Sorry, I didn't notice that this article has more pages to it.
Thank you for you post that gave me a good pointer.
Anybody used JConfig??? Is that a more reliable way of manipulating the JVM Runtime
Yes I was thinking about using the JConfig library, but decided not to as you suggested.
I read the article as pointed out above, but I still don't have a clear mind on how to execute commands in sequence. I kind of got the concept for the gobblers as well. So do I need to use the output gobbler stream if I want to executed a command based on the previous one???
I would really appreciate if anyone provide with a quick code sample...something like this: command1 executed , output is enter password:, then echo myPassword and do something else.
Is that do-able at all or shall I look into an alternative approach. My alternative since I am on linux box to execute a bash script.
subject: Execute commands in a sequance with RunTime.getRuntime().exec(cmd)