开发者

Access output from java compiler in C#

I'm writing a program in C# that will compile java files using the java compiler (javac). I am having trouble capturing the output from javac (a command-line tool) to tell the user of errors. I know how to start a process and capture the st开发者_Go百科andard output, but javac returns nothing. Is there any other way that I can capture the output, or better yet, get a list of errors from java compiler?


May be you better use error output of the process. Process.StandardError


I think this is happening because errors are being sent to stderr instead of stdout. One way you can get around this is to redirect output to stderr to stdout and capture that. eg:

javac files.java 2>&1

Or you can also access the Process.StandardError stream as MAKKAM suggested.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜