dcsimg
runtime.exec executes the command but does not print the file
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   kannan_govindan
Posted On:   Wednesday, June 20, 2001 02:58 AM

Im using the servlet below to print a file inwebsphere test environment.It gives me the output of 0 file(s) copied. The command works fine with a normal java file. Thkx in advance. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TestPrint extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { doPost(req,res); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String command[] = {"C:\winnt\system32\cmd.exe", "/y", "/c", "COPY d:\workstxt.txt lpt1"}; Process p = Runtime.getRuntime().exec(   More>>

Im using the servlet below to print a file inwebsphere test environment.It gives me the output of
0 file(s) copied.
The command works fine with a normal java file.
Thkx in advance.


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestPrint extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { doPost(req,res); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String command[] = {"C:\winnt\system32\cmd.exe", "/y", "/c", "COPY d:\workstxt.txt lpt1"}; Process p = Runtime.getRuntime().exec(command); InputStream is = p.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { System.out.println("@@ "+line); } PrintWriter out = res.getWriter(); out.println("Welcome To Websphere"); } }

   <<Less
About | Sitemap | Contact