I'm trying to call Java from io.js using child_process exec (on Windows), but it says
java is not recognized as an internal or external command
Actually it's not pure io.js, but nw.js, in case it has something to do with that. Here's the code:
var exec = require('child_process').exec, child;
child = exec('java -jar file.jar',
function (error, stdout, stderr){
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if(error !== null){
console.log('exec error: ' + error);
}
});
The command "java -jar file.jar" is working properly if I call it myself from the cmd
Aucun commentaire:
Enregistrer un commentaire