Node.js run a java program?

后端 未结 1 1160
暖寄归人
暖寄归人 2021-02-06 14:12

I have a simple nodejs server up and running. I am running into trouble when I try to spawn a child process. the jar file I am trying to access, is in the same directory as the

1条回答
  •  抹茶落季
    2021-02-06 14:43

    You're executing java. -jar and done.jar are arguments to pass.

    var child = require('child_process').spawn(
      'java', ['-jar', 'done.jar', 'argument to pass in']
    );
    

    You will also need to specify the full path to java, or make sure that java is specified in the OS path.

    0 讨论(0)
提交回复
热议问题