How to read data using Runtime
I wrote the following program to read data from the required file during the runtime. But I'm unable to get any data.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.File;
publicclass RunTime1
{
publicstaticvoid main(String args[])
{
Process p=null;
File filename=new File("RunTime1.java");
BufferedReader reader=null;
String[] cmdarray={"notepad",filename.getAbsolutePath()};
String line=null;
try{
p=Runtime.getRuntime().exec(cmdarray);
reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
p.waitFor();
while((line=reader.readLine())!=null)
System.out.println(line+"-->");
}catch(IOException e){}
catch(InterruptedException ie){}
}
}
What's wrong with this program? Please answer me.

