In advance forgive me for my poor English.
I am trying to run java jar file in nodeJs, and that looks like it's running but it does not show anything until I again save the project(since I am using nodemon reload on save)
The image to below, show what I want to say.
how to we can see, when is running no show any information(red color), but on save(reload by nodemon) i show that is runnig and then error(blue color)
My question is ¿ how can I see the jar is running in nodejs?
MY CODE
const { exec } = require('child_process'); const executeJavaApp = () => { let path = `${__dirname}`; path = path.replace(/\\/g, "/") + '/javaApp/DADKafkaConsumer-1.0.1-SNAPSHOT.jar'; path = path.replace(/\/utils/, ''); exec(`java -jar ${path}`, (error, stdout, stderr) => { console.log(stdout); if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.error(`stderr: ${stderr}`); }); }
INFORMATION
- WINDOWS 10
- NODEJS 12.19.0
没有评论:
发表评论