java - Started Process error stream is empty -


i'm trying control external process java code this:

string[] args = { mpath, "\"" + filepath + "\"" }; processbuilder pb = new processbuilder(args); mprocess = pb.start(); 

then want read stderr:

merror = new bufferedreader(new inputstreamreader(     mprocess.geterrorstream())); if (merror.ready()){     //read } 

and ready() returns false.

but after this:

pb.redirecterror(redirect.to(new file("c:\\err.log"))); 

all error messages can found in err.log file. doing wrong ?

try below code worked me.

 processbuilder builder = new processbuilder(args);  builder.redirecterrorstream(true); // setting  true   

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -