The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
March 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Here you go...

Posted by Kishori Sharan on March 19, 2001 at 3:14 PM

STEP 1> Get the Runtime object
Runtime r = Runtime.getRuntime ( ) ;

STEP2> Execute the Unix command
Process p = r.exec ( "your_unix_command" ) ;
// For example
/* Process p = r.exec ( "ls" ) ; */

STEP3> Get the input stream of the Unix process
InputStream in = p.getInputStream ( ) ;

STEP4> Read the output of the Unix process using InputStream in in whatever way you want.


Thanx
Kishori




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us