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:

ur answer

Posted by Manoj on September 06, 2001 at 4:21 AM

Pls check the location of the file specified in the path. It works perfect with me.

Manoj,

> > 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