Name: mc57594 Date: 07/01/97
Spawning a process with the exec method will fail if the
output from the process is sufficiently long. I have used
exec() to initiate javac, so i don't know if the problem lies
in the Process class or javac.
The process in the following code will hang if the output from
javac, due to errors or warnings, is sufficiently long - about
20 lines or so:
(note: try blocks will have to inserted for this to compile)
String s = "j:\\java\\bin\\javac test.java";
Process comp = Runtime.getRuntime().exec( sb );
input = comp.getInputStream();
error = comp.getErrorStream();
comp.waitFor();
/**
* Code will not get past here.
*/
byte[] imess = new byte[input.available()];
byte[] emess = new byte[error.available()];
input.read(imess);
error.read(emess);
if (imess.length > 0) System.out.println(new String(imess));
if (emess.length > 0) System.out.println(new String(emess));
return comp.exitValue()==0;
======================================================================