I am creating a child process in nodejs where it will compile and execute the java code. Below is the code
const exec = require('child_process').exec;
exec('C:/Development/vilearn/vilearn_node/src/my.bat', (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
console.log(stdout);
});
How can i pass the parameters from exec method to batch file. Below is my batch file.
set path=C:\Program Files\Java\jdk1.8.0_111\bin
cd C:\Development\vilearn\vilearn_node\src
pwd
javac Hello.java
java Hello
As you can see from the above code i am using this batch file to compile the java code. Here i want to pass the path where java file exists and also the name of the java file from exec method so that it will b dynamic.
Please guide me
Help Appreciated!