1

Is there a way to run a jar in a Nodejs as an independent process. I tried using exec. But each time it creates a new process. Is there a way to keep running jar in an independent process and call its procedures as and when required ?

Also, this process will be killed when the process spawning it gets killed.

Is there a way to achieve this ?

I am writing an extension for VSCode. I tried the node-java npm module (https://github.com/joeferner/node-java). But I am running into the following error

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)
Gama11
  • 31,714
  • 9
  • 78
  • 100
Ankuj
  • 713
  • 3
  • 10
  • 27
  • You could encapsulate the 'jar' into a rest webservice, which is being called from Nodejs, by a standard web call. This way you can use the common approach to activate Java functionality via a call from the front-end. – Flying Dutchman May 09 '18 at 07:18
  • i tried that and it worked as well. But the issue is that we want the application to run in offline mode as well – Ankuj May 09 '18 at 07:46

0 Answers0