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.
I have come across below solution with exec method,
exec('java -jar userCode.jar',function (error, stdout, stderr){
});
But this solution does not sound feasible as it involves creating jar file out of the user submitted java code before compiling.
Is there a better solution for this problem?
I found solution with nodeJS library compilex, which allows to compile multiple languages like Java, C, C++, C#, Python etc. It also supports input from User.