Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can you use Runtime command in Servlets?  RSS feed

 
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!