Hi there,
I am trying to call command of cygwin...the input file is from my
java codes and i wanna get the output to java...but it seems i even cant make the command run...i appreciate if someone could help me out..thanks... I use the following codes to
test to redirect the output to a file..but it doesnt work ..
import java.io.*;
public class ExectTest {
public static void main(
String argv[]) {
try {
String ls_str;
String[] cmd = {"c:/cygwin/bin/ls", ">output.dat"};
Process proc = Runtime.getRuntime().exec(cmd);
DataInputStream ls_in = new DataInputStream(ls_proc.getInputStream());
try {
while ((ls_str = ls_in.readLine()) != null) {
System.out.println(ls_str);
}
} catch (IOException e) {
System.exit(0);
}
} catch (IOException e1) {
System.err.println(e1);
System.exit(1);
}
System.exit(0);
}
}
