2

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 standard 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?

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you... I had StandardError set up, but I forgot to redirect the standard error.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.