Forums Register Login

Printing from Sun using Runtime

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 ]
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 673 times.
Similar Threads
I need to control a printer
Any java code for to commit the file/s dynamically in a folder?
print txt file
How to EXEC each line in a file?
Cron ta not working
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:52:47.