I had a node js application and I want to execute a very basic jar file which has System.out.println("Hello"); So that I need to capture that result in one variable.How can we do this. I tried this
var exec = require('child_process').exec;
var child = exec('java -jar ./TestFile.jar',
function (error, stdout, stderr){
console.log('Output -> ' + stdout);
if(error !== null){
console.log("Error -> "+error);
}
});
module.exports = child;
But it is giving me error as
Output ->
Error -> Error: Command failed: C:\windows\system32\cmd.exe /s /c "java -jar ./TestFile.jar"
no main manifest attribute, in ./TestFile.jar
Can someone help how can we run this jar file so that I can display that result on my client side.
via user7350714
No comments:
Post a Comment