I would like to run with Runtime.exec() programs in Java (the programs' code are in C and Java ) - the users are uploading the Java/C code, and my app runs them. The code is saved in a separate folder for each user, as well as the input and output files.
In case of C code, the compilation code is the following:
compileCommand = pathToMinGW + "gcc " + pathToFile + fileName + ".c -o " + pathToFile + fileName
And the command for run:
executeCommand = pathToFile + fileName + ".exe"
Running the command:
Runtime runtime = Runtime.getRuntime();
Process run = runtime.exec(executeCommand);
How can I give permissions for the exec() function, to let to modify the output files from the folder where the uploaded code is, but nothing other?
