This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 9137
    
    9

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.


[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.
 
Have you checked out Aspose?
 
subject: Problem with Process and his OutputStream
 
It's not a secret anymore!