1

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.**

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.