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[]) ...

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: (java.lang.Runtime()).exec(new String[]) ...
Date 2011-12-09 23:00 -0800
Organization http://groups.google.com
Message-ID <29544146.1320.1323500401535.JavaMail.geo-discussion-forums@prkz16> (permalink)
References <1322956063.644169@nntp.aceinnovative.com> <1323496863.17965@nntp.aceinnovative.com>

Show all headers | 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