a quick example catching the output from ls -l your home directory
Code:
import java.io.*;
public class Running
{
public static void main(String args[])
{
Runtime rTime=Runtime.getRuntime();
String output;
try
{
Process rProcess=rTime.exec("ls -l " + System.getProperty("user.home"));
BufferedReader bufRead=new BufferedReader (new InputStreamReader(rProcess.getInputStream()));
while( (output=bufRead.readLine())!=null)
{
System.out.println(output);
}
}catch(IOException ioe)
{
System.err.println(ioe);
System.exit(1);
}
}
}