joeferner / node-java

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

Mac OS cannot find java #327

Open tommyz0123 opened 8 years ago

tommyz0123 commented 8 years ago

I'm running mac os x el capitan 10.11.4

$ sudo npm install -g

java@0.7.0 install /usr/local/lib/node_modules/java node-gyp rebuild

CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o SOLINK_MODULE(target) Release/nodejavabridge_bindings.node

java@0.7.0 postinstall /usr/local/lib/node_modules/java node postInstall.js

/usr/local/lib └── java@0.7.0

$ node test/test.js module.js:338 throw err; ^

Error: Cannot find module 'java' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/Users/guzhang/projects/node-java/test/test.js:1:74) at Module._compile (module.js:434:26) at Object.Module._extensions..js (module.js:452:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:475:10)

The tets.js contains this:

var java = require('java'); var javaLangSystem = java.import('java.lang.System');

javaLangSystem.out.printlnSync('Hello World');

junqdu commented 7 years ago

@tommyz0123 did you get this figured out?