加了options参数 {encoding:’gb2312’} 也是一样
代码
var process = require('child_process');
var options={encoding:'utf8'};
var java = process.spawn('javac', ['App.java'],options);
java.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
java.on('close', function (code) {
console.log('child process exited with code ' + code);
});
console.log('Spawned child pid: ' + java.pid);