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
Post a Comment