• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communicating with unix command process from java using stream

 
megha joshi
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to use stream based IPC in Java. To test this I am trying to exec unix more filename command from my java code. Interesting thing is commands like ps, man, ls -l execute fine using the code below. But executing more on a big file , which requires enter input from keyboard occasionally fails. I would like to give input to this unix process from my java code..but I am not sure how to do that. The code I have so far is as follows:

 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search for the Javaworld article "When Runtime.exec() won't". It's a must-read when working with Processes.
 
megha joshi
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..I went through it though issues mentioned in the article, are not relevant for this case. Any other suggestions? Thanks again!
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
megha joshi wrote:issues mentioned in the article, are not relevant for this case.

Are you sure? Perhaps the process is being paused because its output / error buffer is full, something that is very clearly discussed in the article. Once you clear the output and error buffers it may continue again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic