Hello, im trying to write to an external program and the inputs and outputs works fine for the first time that im printing the stdin. After this time the program look like it stuck.

Help Please.

Recommended Answers

All 7 Replies

post the error that was thrown when compile/running...

Try debugging your program by adding println() statements to show where it is executing and how the variables are changing value.

post the error that was thrown when compile/running...

there is no error, it just get stucked immidiate after the first while ((s = stdInput.readLine()) != null) at the moment it should be null.

Try debugging your program by adding println() statements to show where it is executing and how the variables are changing value.

i tried that and i saw that stdin is never reached to null, and the program stucked at the time that the buffer supose to be empty.

Is it working ok now?

Is it working ok now?

it does not work and i think i ound out the reason.
the readline is waiting to a new line and its not getting the null cause i didnt close the stdout. i cant close the stdout cause i want to use it after so ill have to think about somthing different.

thanks

Can you use the available() method to check before reading to keep from blocking?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.