Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8334
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!v9g2000vbp.googlegroups.com!not-for-mail |
|---|---|
| From | SamuelXiao <foolsmart2005@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Java Runtime getRuntime().exec not work in AIX |
| Date | Mon, 26 Sep 2011 08:28:38 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 32 |
| Message-ID | <39eb6d25-5671-48b6-90b0-ef2ffb568dc6@v9g2000vbp.googlegroups.com> (permalink) |
| References | <da7da6db-b203-41eb-b217-5505afd20d28@i21g2000yqk.googlegroups.com> <4e7bded3$0$286$14726298@news.sunsite.dk> <b938af91-d278-461a-9e1d-f25743df83d7@s20g2000yqh.googlegroups.com> <4e7cfddd$0$287$14726298@news.sunsite.dk> <slrnj7q870.6gl.avl@gamma.logic.tuwien.ac.at> |
| NNTP-Posting-Host | 113.252.244.58 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1317050918 13639 127.0.0.1 (26 Sep 2011 15:28:38 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Mon, 26 Sep 2011 15:28:38 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | v9g2000vbp.googlegroups.com; posting-host=113.252.244.58; posting-account=u7Z5bAoAAAAt3dGtAbye_zJ7B1CGCs-X |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | HUALESNKRC |
| X-HTTP-UserAgent | Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8334 |
Show key headers only | View raw
On Sep 23, 8:14 pm, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at>
wrote:
> Arne Vajhøj <a...@vajhoej.dk> wrote:
> > On 9/23/2011 10:35 AM, SamuelXiao wrote:
> >> String[] cmds ={"/bin/ksh","-c","uuencode /log/test.log attached.log |
> >> mailx -s 'Testing' a...@example.com "};
> >> System.out.println("Before process run");
> >> Process process = Runtime.getRuntime().exec(cmds);
> >> System.out.println("After process run");
> >> both message displayed, but the process really not running.
> > That code is not reading output and error from the process.
>
> What may be even more relevant than reading from channels
> that likely won't send data, anyway, is to call .waitFor()
> on the process returned by the .exec(...)-call, in order to
> ensure that "After process run" is really printed after the
> run, instead of already after merely being kicked off.
>
> Reading from the error channel, like Arne suggested, might
> still be a good idea - unless you really don't care about
> any failures of uuencode or mailx. Logging errors could also
> be done by ">>/tmp/debug-uuencode-and-mailx.log 2>&1" added
> to the little ksh-script.
Hi all,
Thanks very much, the problem has been solved. After I added
p.waitfor() after .exec(cmds), the process run successfully. Although
I don't know why need to add waitfor() to it.
Thanks
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Java Runtime getRuntime().exec not work in AIX SamuelXiao <foolsmart2005@gmail.com> - 2011-09-22 08:09 -0700
Re: Java Runtime getRuntime().exec not work in AIX Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-09-22 14:56 -0700
Re: Java Runtime getRuntime().exec not work in AIX SamuelXiao <foolsmart2005@gmail.com> - 2011-09-23 07:31 -0700
Re: Java Runtime getRuntime().exec not work in AIX Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-09-23 10:20 -0700
Re: Java Runtime getRuntime().exec not work in AIX Arne Vajhøj <arne@vajhoej.dk> - 2011-09-22 21:20 -0400
Re: Java Runtime getRuntime().exec not work in AIX SamuelXiao <foolsmart2005@gmail.com> - 2011-09-23 07:35 -0700
Re: Java Runtime getRuntime().exec not work in AIX Patricia Shanahan <pats@acm.org> - 2011-09-23 09:45 -0700
Re: Java Runtime getRuntime().exec not work in AIX Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 17:45 -0400
Re: Java Runtime getRuntime().exec not work in AIX Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-24 00:14 +0000
Re: Java Runtime getRuntime().exec not work in AIX Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 20:41 -0400
Re: Java Runtime getRuntime().exec not work in AIX SamuelXiao <foolsmart2005@gmail.com> - 2011-09-26 08:28 -0700
Re: Java Runtime getRuntime().exec not work in AIX Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-26 22:33 +0000
Re: Java Runtime getRuntime().exec not work in AIX Lars Enderin <lars.enderin@telia.com> - 2011-09-24 10:59 +0200
Re: Java Runtime getRuntime().exec not work in AIX Roedy Green <see_website@mindprod.com.invalid> - 2011-09-26 02:27 -0700
Re: Java Runtime getRuntime().exec not work in AIX Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-26 09:32 +0000
Re: Java Runtime getRuntime().exec not work in AIX Lars Enderin <lars.enderin@telia.com> - 2011-09-26 19:42 +0200
Re: Java Runtime getRuntime().exec not work in AIX Arne Vajhøj <arne@vajhoej.dk> - 2011-09-26 19:31 -0400
Re: Java Runtime getRuntime().exec not work in AIX Roedy Green <see_website@mindprod.com.invalid> - 2011-09-24 16:29 -0700
csiph-web