The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Same problem with JSP

Posted by Ritu S Parihar on May 02, 2001 at 7:11 AM

> Hi,
> I was trying to run a batch file from my program, so I did the following:
>
/***** code from here*********
<%@ page language="java" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.io.*" %>
<%
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = { "C:\\WINNT\\system32\\Cmd.exe",
"D:\\Temp\\Test.cmd" };
try {
Process child = rt.exec(callAndArgs);
child.wait();
out.println("Process exit code is:" + child.exitValue());
}
catch(IOException e) {

out.println("IOException starting process! 1\n");
out.println(e.getMessage());
}
catch(InterruptedException e) {
out.println("Interrupted waiting for process!2");
}
%>
************** End of the code/
it's giving error "IOException starting process! File not found"

> Could anyone help me with this problem?
> Thanks
> Sasipriya






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us