I'm utilising the MEAN stack to create an online coding test app. Looking for a nodejs solution to compile and submit the Java code entered by the user in the editor. The user may enter the test parameters, execute it, and examine the results.
I found the solution below, which uses the exec approach
exec('java -jar userCode.jar',function (error, stdout, stderr){
});
However, this method does not appear to be practicable because it requires building a jar file from the user's java code before compiling it.
Is there a better way to solve this issue?