I'm having some trouble here. Why am I getting the Exception(below)?
How does the trace help me debug in this instance? What is error=5?
My grep works from the command line.
I will implement this in a *servlet* when I figure out how to get this
to work.
I'm trying tho keep this simple until then. If my question is
inappropriate for
this list I appologize. Please let me know where it does belong.
import java.io.*;
public class externprocess {
public static void main(String[] args)
{
Runtime r;
Process p;
DataInputStream in;
PrintStream out;
String currentLine;
/* Run grep32 command process
*/
r = Runtime.getRuntime();
String[] commandArray =
{"E:\\tools\\grep32","\"aSearchString\"","*.*"};
try
{
p = r.exec(commandArray);
in = new DataInputStream(p.getInputStream());
while ((currentLine = in.readLine()) != null)
{
System.out.println(currentLine);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
Generates the following trace:
java.io.IOException: CreateProcess: E:\tools\grep32 "aSearchString" *.*
error=5
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Compiled Code)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Compiled Code)
at java.lang.Runtime.exec(Runtime.java:219)
at externprocess.main(Compiled Code)
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]