Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10667
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Nigel Wade <nmw-news@ion.le.ac.uk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: (java.lang.Runtime()).exec(new String[]) ... |
| Date | Mon, 12 Dec 2011 14:31:10 +0000 |
| Lines | 25 |
| Message-ID | <9kmhheFk40U1@mid.individual.net> (permalink) |
| References | <1323496863.17965@nntp.aceinnovative.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net lp5qN9Dl9GXgaYe+LOT/oACkPWed7ZUosG6E5eH1L453H5KkAq |
| Cancel-Lock | sha1:vg2oYsYqhQfMK8BjjyJL/B9QRyY= |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11 |
| In-Reply-To | <1323496863.17965@nntp.aceinnovative.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10667 |
Show key headers only | View raw
On 10/12/11 06:01, lbrt chx _ gemale wrote:
> Something like this:
> ~
> Process proc = (java.lang.Runtime()).exec((new String[]{"ls", "-l", "/media/sda1/Physical_Basis.flv"}));
> ~
> works just fine.
> ~
> Why doesn't something like, say:
> ~
> Process proc = (java.lang.Runtime()).exec((new String[]{"date;", "time","ls", "-l", "/media/sda1/Physical_Basis.flv;", "date;"}));
> ~
> work?
> ~
Besides the other problems, even if the code were executable it would
fail because you are attempting to run a sequence of commands.
Process.exec() runs one command, the first argument. The rest of the
string elements are arguments to that command. It will not run a
sequence of commands as implied by the ";" ending each of the first two
commands. That requires you to use a shell to interpret the command
sequence.
--
Nigel Wade
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
(java.lang.Runtime()).exec(new String[]) ... lbrt chx _ gemale - 2011-12-10 06:01 +0000 Re: (java.lang.Runtime()).exec(new String[]) ... Lew <lewbloch@gmail.com> - 2011-12-09 23:00 -0800 Re: (java.lang.Runtime()).exec(new String[]) ... Roedy Green <see_website@mindprod.com.invalid> - 2011-12-10 02:44 -0800 Re: (java.lang.Runtime()).exec(new String[]) ... Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-12-12 14:31 +0000
csiph-web