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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -