Online java coding test: compile submitted java code in nodejs
<p>I am doing an online coding test application using MEAN stack. Looking for a solution in nodejs, to compile the Java code that user enters in editor and submits. User can enter the test input, run and check for the output. </p>

<p>I have come across below solution with exec method,</p>

<pre><code>exec('java -jar userCode.jar',function (error, stdout, stderr){
});
</code></pre>

<p>But this solution does not sound feasible as it involves creating jar file out of the user submitted java code before compiling.</p>

<p>Is there a better solution for this problem?</p>