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!

user2597012
  • 581
  • 4
  • 9
  • 28

1 Answers1

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.

PomPom
  • 1,468
  • 11
  • 20