joeferner / node-java

Bridge API to connect with existing Java APIs.
MIT License
1.88k stars 283 forks source link

Does not load jvmlib.dylib file when packaged in app #410

Open kreenasmehta opened 7 years ago

kreenasmehta commented 7 years ago

Application works with npm start. Also, works fine on Windows. Issue is only on MacOS.

I am seeing this error when I try to run my application (I am using electron):

/Applications/ExportDataTool/App.app/Contents/Resources/app/node_modules/java/lib/nodeJavaBr…:21 /Applications/AppTool/App.app/Contents/Resources/app/node_modules/java/build/Release/nodejavabridge_bindings.node angular.js:14642 Error: dlopen(/Applications/AppTool/App.app/Contents/Resources/app/node_modules/java/build/Release/nodejavabridge_bindings.node, 1): Library not loaded: @rpath/libjvm.dylib Referenced from: /Applications/AppTool/App.app/Contents/Resources/app/node_modules/java/build/Release/nodejavabridge_bindings.node Reason: image not found 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 Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/Applications/AppTool/App.app/Contents/Resources/app/node_modules/java/lib/nodeJavaBridge.js:22:16) at Object. (/Applications/AppTool/App.app/Contents/Resources/app/node_modules/java/lib/nodeJavaBridge.js:317:3) "" (anonymous) @ angular.js:14642 (anonymous) @ angular.js:11102 ua @ angular.js:10522 q @ angular.js:9909 f @ angular.js:9149 (anonymous) @ angular.js:9014 (anonymous) @ angular.js:9405 d @ angular.js:9192 m @ angular.js:9959 B @ angular-route.js:1012 $broadcast @ angular.js:18698 (anonymous) @ angular-route.js:652 (anonymous) @ angular.js:17000 $digest @ angular.js:18182 $apply @ angular.js:18480 l @ angular.js:12501 s.onload @ angular.js:12655

dasarindam commented 7 years ago

@kreenasmehta I have done somekind of work around and posted in another issue log. Try if that works. https://github.com/joeferner/node-java/issues/379

kreenasmehta commented 7 years ago

@dasarindam Thanks for your reply. This fix is related to Windows, whereas I was seeing issues on a Mac. I was able to fix my issue with these changes: https://github.com/joeferner/node-java/pull/413