Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10641

Re: (java.lang.Runtime()).exec(new String[]) ...

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: (java.lang.Runtime()).exec(new String[]) ...
Date Fri, 9 Dec 2011 23:00:01 -0800 (PST)
Organization http://groups.google.com
Lines 27
Message-ID <29544146.1320.1323500401535.JavaMail.geo-discussion-forums@prkz16> (permalink)
References <1322956063.644169@nntp.aceinnovative.com> <1323496863.17965@nntp.aceinnovative.com>
Reply-To comp.lang.java.programmer@googlegroups.com
NNTP-Posting-Host 173.164.137.214
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1323500402 30500 127.0.0.1 (10 Dec 2011 07:00:02 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Sat, 10 Dec 2011 07:00:02 +0000 (UTC)
In-Reply-To <1323496863.17965@nntp.aceinnovative.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10641

Show key headers only | View raw


(unknown) wrote:
> Something like this: 

Not too very like, I think - 

>  Process proc = (java.lang.Runtime()).exec((new String[]{"ls", "-l", "/media/sda1/Physical_Basis.flv"}));
> ~ 
>  works just fine.

except that it won't compile, as Stefan hinted.

>  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?

For starters, for the same reason the other one doesn't.

Please reply with a copy-and-paste of the output from 'javac' on these idioms, placed into an SSCCE, of course. 

A minor point unrelated to your major question - you never have to specify 'java.lang' for the types in that package.  Just 'Runtime' will do nicely, thank you.

<http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html>

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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