• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can you use Runtime command in Servlets?

 
Travis Gibson
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Fellow Ranchers,
I have a small problem. I need to execute the following Runtime commands:
String command = "AcroRd32.exe /p /h C:/TestPrint.pdf";
Runtime.getRuntime().exec(command);
This code opens the adobe reader and passing a pdf to be printed out. It works fine from the command line in a standalone app but it will not print from a servlet. Does anyone know why?
Regards,
Travis M. Gibson, SCJP
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried giving the full path to the AcroRead.exe file? It may be that the PATH setting is different for the JSP container.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!