Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

xsh yang

Greenhorn
+ Follow
since Jul 03, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by xsh yang

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);
}
}
18 years ago