IntelliJ Java IDE
The moose likes Servlets and the fly likes How can you use Runtime command in Servlets? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How can you use Runtime command in Servlets?" Watch "How can you use Runtime command in Servlets?" New topic
Author

How can you use Runtime command in Servlets?

Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
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


Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>travis@travismgibson.com
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
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.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
 
subject: How can you use Runtime command in Servlets?
 
Threads others viewed
RunTime error with main
how to execute a command from java application
command prompt from java
runtime exec
Extract .Z files
MyEclipse, The Clear Choice