And from http://www.vnoel.com/Computers-Related-Issues/Java-problem-Too-many-open-files.html,
http://www.velocityreviews.com/forums/t139735-too-many-open-named-pipes-in-a-java-process.html
I see Runtime.getProcess() method automatically opens three streams
(stdout, stderr, stdin) each time the getProcess() is called. It is
the responsibility of the caller to close those streams when done.
But if I just call it directly like this:
Runtime.getRuntime().exec("chmod 777 " + getFileName());
and doesn't get the returned Process and doesn't call
process.getInputStream()
Do I still need to close stream and how?
Any help is appreciated.
>Do I still need to close stream and how?
see http://mindprod.com/jgloss/exec.html
see sample code for how to close. Scan for "close".
--
Roedy Green Canadian Mind Products
http://mindprod.com
A vote for McCain is fearful clinging to McSame.
A vote for Obama is a shot at Obamalot.
Good question.
I would expect "no".
But I doubt that it is specified anywhere.
If you want to know for a specific implementation then check
the source.
If I look at the ProcessImpl class for SUN Java 1.6 then it
looks as if one should get the streams and explicit close
them.
Arne
Yes. You need to close all three streams. You also need to wait for the
child process, otherwise it becomes a zombie.