Meaningless Drivel is fun!*
The moose likes I/O and Streams and the fly likes Problem with Process and his OutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Problem with Process and his OutputStream" Watch "Problem with Process and his OutputStream" New topic
Author

Problem with Process and his OutputStream

Stefan Litzel
Greenhorn

Joined: Feb 20, 2009
Posts: 2
Hey guys,

i hope you can help me with my little problem.

I want to execute a cmd command with the ProcessBuilder, but for some reason writing information to the stdin of the console doesnt work properly.

I tried the following:



The output on the console is as expected the question for the admin password. But when i try to write the pass to the console nothing happens.


Best wishes

Stefan Litzel
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Stefan Litzel wrote:But when i try to write the pass to the console nothing happens.


Is your code even getting that far? You are reading from the process' output stream until EOF (indicated by a null). I wouldn't expect that to happen until the process terminates. Try printing to the screen between your read and write.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Stefan Litzel
Greenhorn

Joined: Feb 20, 2009
Posts: 2
I also tried it without the InputStream of the cmd program. Still the same.
 
 
subject: Problem with Process and his OutputStream
 
Similar Threads
Catching InputStream from Runtime/Process
opening a new cmd and writing to it
Closing streams of processes openend from Java
how to finish the process forcibly?
Java interprocess communication