Can anyone tell me why the Runtime.exec() call in the following piece of
code runs fine standalone, but blows chunks in Tomcat 4?

    File path = new File("E:/WebProjects/lutris/cvs/Barracuda/src");
    String[] args = new String[] {"ant.bat","admin.sample1"};
    try {
        Process p = Runtime.getRuntime().exec(args, null, path);
        StringBuffer sbOut = new StringBuffer(1000);
        BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));
        while (true) {
            String s = br.readLine();
            if (s==null) break;
            System.out.println(s);
        }
        br.close();
        p.waitFor();
        System.out.println (sbOut.toString());
        System.out.println ("Exit status: "+p.exitValue());
    } catch (Exception e) {
        System.out.println ("Unexpected error executing cmd:"+e);
    }

Like I said, it works fine when run as an application. But in Tomcat, I get
the following stack trace:

Path: E:\WebProjects\lutris\cvs\Barracuda\src (exists=true)
Args[0]: ant.bat
Args[1]: admin.sample1
Unexpected error executing cmd:java.io.IOException: CreateProcess: ant.bat
admin.sample1 error=2
java.io.IOException: CreateProcess: ant.bat admin.sample1 error=2
        at java.lang.Win32Process.create(Native Method)
        at java.lang.Win32Process.<init>(Unknown Source)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Unknown Source)
        ...
        <snip>
        ...

Suggestions? Is there something I don't know about invoking Runtime.exec()
from with a servlet?

Thanks,
Christian
----------------------------------------------
Christian Cryder [[EMAIL PROTECTED]]
Internet Architect, ATMReports.com
Barracuda - http://barracuda.enhydra.org
----------------------------------------------
 "What a great time to be a(n employed) Geek"


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to