• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing from Sun using Runtime  RSS feed

 
Eric Chang
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so I had asked a question a few months ago about running a script on a Sun box and the answer was to use something along the lines of:

Process exec = Runtime.getRuntime().exec("script");

Now, I'm attempting to execute the following command:

postprint filename.tmp | lpr

through Java...and no matter how I do it using the above, I cannot get it to execute, yet when I do it just on the command line, it works fine.
I read some of what's here and saw there there might be an issue with me piping the output into lpr, so I tried using just lpr, and that didn't work either.
Anyone have any ideas why this might be failing?
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tutorial you provided a link to clearly states why piping won't work and also shows you a solution. I suggest you read page 4 of the tutorial again.
 
Eric Chang
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I understand why the piping doesn't work, however the tutorial didn't explain why just doing "lpr filename.txt" didn't work either...unless I'm guessing that the fact that lpr takes in arguments is the same problem as piping to a file.
I will scour that tutorial again to see if I missed something more.

Fake Edit: Yeah, that's exactly what it is...nevermind.

[ September 30, 2008: Message edited by: Eric Chang ]
[ September 30, 2008: Message edited by: Eric Chang ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!