1. If you don't flush the bw stream, the commands may still be in the buffer. 2. You really need to set up a separate Thread to read the output - if the process output doesn't get consumed, it may just sit there. Bill

because I wanted to start with easy commnads I know the results of rather than the actuall commands that will be run

Tom Hill
Ranch Hand

Joined: Aug 24, 2003
Posts: 115

posted Sep 07, 2004 07:55:00

0

Interesting : on windows /k is required to keep the shell open to write commands too. In unix the first command has to be a shell command such a ksh and proceeding commands are written to it and then the new shell dies after leaving.

But:

doing: String[] commands = {"ksh","klog username","password"}; Hangs! I assumed it might be that a new terminal is created for the password prompt but then: echo password | klog username wouldnt work: and java doesnt like: commands ={"ksh","echo password | klog user"}; for the same reason - could it be that Java cannot cope with prompts that do not display the shell's input?

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823

posted Sep 07, 2004 08:14:00

0

I think it might have something to do with Bill's comment about consuming the process's output streams. See this Javaworld article for more detail.