Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23157
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | markspace <markspace@nospam.nospam> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why does this only work when I am running a shellscript |
| Date | Sat, 30 Mar 2013 08:23:26 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 15 |
| Message-ID | <kj6vt9$3c7$1@dont-email.me> (permalink) |
| References | <8738vdmg0h.fsf@Servus.decebal.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sat, 30 Mar 2013 15:21:13 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="fba3415ba68d85d643935af2f52f0b4b"; logging-data="3463"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Hp9ID8sfhZedT3rtIdS9JSYHzQr7/bx0=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 |
| In-Reply-To | <8738vdmg0h.fsf@Servus.decebal.nl> |
| Cancel-Lock | sha1:XM6Z1lbOwfuF+JKNxP1GysV3s6Y= |
| Xref | csiph.com comp.lang.java.programmer:23157 |
Show key headers only | View raw
On 3/30/2013 1:46 AM, Cecil Westerhof wrote:
> I have the following code:
> private static void doCommand(final String cmd) throws IOException {
> Process p;
> Scanner sc;
>
> System.out.println("#" + cmd + "#");
> p = Runtime.getRuntime().exec(cmd);
> sc = new Scanner(p.getInputStream());
Besides Barb's answer, I believe you also have to drain the output
stream. If you don't read a program's output, it'll hang, waiting for you.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why does this only work when I am running a shellscript Cecil Westerhof <Cecil@decebal.nl> - 2013-03-30 09:46 +0100
Re: Why does this only work when I am running a shellscript Barb Knox <see@sig.below> - 2013-03-31 03:54 +1300
Re: Why does this only work when I am running a shellscript Steven Simpson <ss@domain.invalid> - 2013-03-30 16:07 +0000
Re: Why does this only work when I am running a shellscript markspace <markspace@nospam.nospam> - 2013-03-30 08:23 -0700
Re: Why does this only work when I am running a shellscript Arne Vajhøj <arne@vajhoej.dk> - 2013-03-30 11:34 -0400
Re: Why does this only work when I am running a shellscript Roedy Green <see_website@mindprod.com.invalid> - 2013-03-30 08:35 -0700
Re: Why does this only work when I am running a shellscript RVic <rvince99@hotmail.com> - 2013-03-30 08:41 -0700
Re: Why does this only work when I am running a shellscript Joerg Meier <joergmmeier@arcor.de> - 2013-03-31 01:00 +0100
Re: Why does this only work when I am running a shellscript Roedy Green <see_website@mindprod.com.invalid> - 2013-03-31 17:04 -0700
Re: Why does this only work when I am running a shellscript Steven Simpson <ss@domain.invalid> - 2013-03-30 16:13 +0000
csiph-web