import java.io.*;
class cmdtest
{
public static void main(
String args[]) throws Exception
{
BufferedReader bufRead = cmdtest.executeCommand();
String str;
while((str = bufRead.readLine()) != null)
{
System.out.println("" + str);
}
}
public static BufferedReader executeCommand( ) throws IOException
{
String str;
Runtime rt=Runtime.getRuntime();
BufferedReader bufInp=null;
try
{
Process p=rt.exec("help");
Process p=rt.exec("ls -l");
bufInp=new BufferedReader ( new InputStreamReader ( p.getInputStream() ) );
}
catch ( IOException ioExc )
{
ioExc.printStackTrace();
System.out.println("IO Exception: " + ioExc.getMessage() );
}
return bufInp;
}
}
Probably this will help.
Rashid