Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!feed.xsnews.nl!border-2.ams.xsnews.nl!feeder.xennanews.com!nf40.xennanews.com!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Why does this only work when I am running a shellscript Organization: Decebal Computing X-Homepage: http://www.decebal.nl/ Date: Sat, 30 Mar 2013 09:46:38 +0100 Message-ID: <8738vdmg0h.fsf@Servus.decebal.nl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:qvRkwDwxuWZpA604th0FV2wGKkY= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@xennanews.com Lines: 28 NNTP-Posting-Host: 84.53.123.169 (84.53.123.169) NNTP-Posting-Date: Sat, 30 Mar 2013 09:58:51 +0100 Xref: csiph.com comp.lang.java.programmer:23155 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()); while (sc.hasNext()) { System.out.println(sc.nextLine()); } } When I call s shellscript like: doCommand("createQuote.sh citation"); It works as I would expect. When I use something like: /usr/bin/convert … It hangs. It is not the command, because if I execute the command I print in the shell directly, there is no problem. So what is happening here? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof