在Nodejs中运行jar作为单独的进程

时间:2018-05-08 12:01:56

标签: java node.js vscode-extensions node-java

有没有办法在Nodejs中运行jar作为一个独立的进程。我尝试过使用exec。但每次它创建一个新的过程。有没有办法在独立的进程中继续运行jar并在需要时调用它的程序?

此外,当生成它的进程被杀死时,此进程将被终止。

有没有办法实现这个目标?

我正在为VSCode编写扩展程序。我尝试了node-java npm模块(https://github.com/joeferner/node-java)。但是我遇到了以下错误

Activating extension `Adobe.adobe-mardown-previewer` failed:  A dynamic link library (DLL) initialization routine failed.
node_modules\java\build\Release\nodejavabridge_bindings.node
Here is the error stack:  Error: A dynamic link library (DLL) initialization routine failed.
node_modules\java\build\Release\nodejavabridge_bindings.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.J.Z.t.getExtensionPathIndex.then.o._load (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:653:398)
    at Module.require (module.js:498:17)
    at Module.patchedRequire [as require] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\xxxxx\Downloads\live-html-preview-master\node_modules\java\lib\nodeJavaBridge.js:21:16)
    at Object.<anonymous> (C:\Users\xxxxx\Downloads\live-html-preview-master\node_modules\java\lib\nodeJavaBridge.js:316:3)

0 个答案:

没有答案