0

I am developing a website where users can upload java and C++ programs. After a program is uploaded, the website invokes other Java program (Also I am developing it) that compiles, runs and tests the compiled programs correctness. Now I am at the first step which is compiling and running the submitted programs by creating a process which runs the CMD and it works fine. However, the problem is that the output is printed on the console... I want the output (result) to be returned to the program I am developing. Is there a way for the programs results to be communicated?

Thanks for your help guys!

1 Answer 1

0

If you are using standard output, you can redirect sysout and syserr :

System.setOut(new PrintStream(myOutputStream));
System.setErr(new PrintStream(myOutputStream));

Another solution could be a logger, like Log4j.

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

1 Comment

Thanks for your answer. I am new at Java, kindly will you put an example?

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.