Need help in Runtime.exec() command
807599Dec 5 2006 — edited Dec 6 2006I like to execute this command in java as below, but it seems doesn't work as expected...
Anybody knows how it works?
String cmd = "netstat -a | grep 8555 | grep ESTABLISHED | wc -l";
Process p = Runtime.getRuntime().exec(cmd);
The program was running unix env for this cmd to execute.
However, it looked like only the first part "netstat -a" got executed and the rest after | is ignored...
Is that the limitation of Process in java (not seeing the rest of cmd...)?
thanks in advance for any help.