Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Premature EOF from runtime.exec()  RSS feed

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, if this is the wrong forum, my appologies.
I have a servlet that executes a C++ program on Solaris. The problem I'm having comes in streaming the output from the servlet to the client app. The client is also a Java client.
The code looks like this (but a bit more complex)
OutputStream = (OutputStream)response.getOutputStream;

Runtime rt = Runtime.getRuntime();
Process pro = rt.exec(cmd);
InputStream is = pro.getInputStream();
byte[] buffer = new byte[266];
int bytes =;
if(bytes == -1) break;
}// end while
Regardless of the size of output (and it is usally quite large) I get one of two errors. either an OutOfMemoryError from the servlet or Unexpected EOF Exception from the client.
Does anybody have any ideas? Would I have the same trouble if I used JNI?
thanks in advance
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
ScroogeXHTML 7.2 - RTF to HTML5 / XHTML converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!