Blocking Due to the Absence of a New Line Character

I am presently attempting to write a GUI program that will conduct basic runtime tests on another user's program. The program will prompt the user to enter their program name and it will then compile and run it. Unfortunately, I am already having problems !!!

I am using the Process class 'getInputStream' and 'getOutputStream' methods to read and write information to and from the user's command line prompt program. The first problem I encounter is that if the program I am trying to run prompts the user for an answer and does not have a new line character\carriage return my program cannot read the command prompt ie.

The user's program that I am running would prompt the user for some input and not return until the user has entered their command and then pressed the return key:

bash-2.04$ What is your command ? <>

I would ask if there is a way to solve this perhaps using the InputStream 'available' method or am I using completely the wrong method/procedure.

Additionally, I have been having problems reading additional information that is passed by the user's program - should I be reading and writing using Strings/characters/bytes ?

Has anyone else encountered this problem and if so did you discover a solution - I unfortunately have spent the past 2 weeks reading various discussion forums and publications that are similar but none have been able to enlighten me.

I look forward to receiving any help or advice that you can offer.

[1512 byte] By [ceeescba] at [2007-9-27 7:07:43]
# 1

It's been a while since I worked on this sort of design, but I rememeber quite a few interesting little issues:

1. You have to figure out how to recognize the end of user program output. You have apparently just discovered that you can't count on some end-of-line character, so now you have to (hope you can) find something else.

2. You MAY have further issues with how the user program acts in detail - whether or when it flushes its output so you can read it.

I'm afraid this is very general, but I've found that with some work I solved the problem for ONE user program written in ONE language running on ONE operating system.

bschauwea at 2007-7-8 10:18:02 > top of Java-index,Desktop,Runtime Environment...