----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


>       Process process = Runtime.getRuntime().exec("ls");
>
>       BufferedReader br = new BufferedReader(new
>               InputStreamReader(process.getInputStream()));
>
>       String line;
>
>       while((line = in.readLine()) != null) {
>               out.println(line);
>       }
>
>
> the above code prints out the result of an ls directory listing

Yeah, but its not at all portable, its also a lot more resource hungry as
your having to shell a separate process to do this.  It would be much easier
to use the java.io.File suite of classes/methods to do this, will making it
all portable.

I have seen this many times before, where people say, 'but it will only ever
run on Unix', but somebody somewhere wants it on another before too long.
Save yourself lots of work in the future, and allow Java do as much as
possible.

A



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to