I am executing a java program(Test.java) using
[Note:I already compiled it successfully]
Process p=Runtime.getRuntime().exec("java Test");
This goes well until Test doesn't wait for any user input... So , for user input i used
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
As , i don't know how much user input will Test.java take ,so i used this
while(p.isAlive()){
String input=in.nextLine();
bw.write(input);
bw.newLine();
}
But this thing isn't working.
So i just want to know why BufferedWriter object is not passing the input to Test.java at the instant when i do bw.write.Because p.isAlive() is always true due to which my program is going into infinte loop. *Thanks in advance.**