Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic