Article View: borland.public.jbuilder.java.language
Article #7430How to use getRuntime().exec and Unix Pipe??
From: Tom Harrop
Date: Fri, 22 Jun 2001 21:04
Date: Fri, 22 Jun 2001 21:04
29 lines
1426 bytes
1426 bytes
Ok, I know how to use the getRuntime().exec command.
But, I can't seem to get this to work with a Unix Pipe???
Any ideas?
Thanks
try {
String[] kshCommand =
{
"/bin/ksh"
,"-c"
,"command"
,"command_arg1"
,"command_arg2"
,"|"
,"grep xyz"
};
java.lang.Process p = java.lang.Runtime.getRuntime().exec(kshCommand);
// deal with stdout, stdin and stderr of the child process using
p.getInputStream();
p.getOutputStream();
p.getErrorStream();
// Now wait for the process completion
p.waitFor();
} catch (IOException ioe) {
}
Technical Details
Message-ID:
<3b33b159$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,88fbb3b1aa86f386,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-22 14:14:07 PST Reply-To: "Tom Harrop" <tch1@osi.com> From: "Tom Harrop" <tch1@osi.com> Newsgroups: borland.public.jbuilder.java.language Subject: How to use getRuntime().exec and Unix Pipe?? Date: Fri, 22 Jun 2001 14:04:10 -0700 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 205.227.114.99 Message-ID: <3b33b159$1_2@dnews> X-Trace: dnews 993243481 205.227.114.99 (22 Jun 2001 13:58:01 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews