File tree Expand file tree Collapse file tree 4 files changed +32
-7
lines changed
Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,9 @@ $ npm install java
2828```
2929
3030Notes:
31- * If you see an error such as "Error: The specified module could not be found.
32- xxxxxx\node_modules\java\build\Release\nodejavabridge_bindings.node".
33- Ensure the directory where jvm.dll exists is in your PATH. (e.g. C:\Program Files (x86)\Java\jdk1.6.0_18\jre\bin\client).
34- This path cannot have quotes.
3531* node-gyp requires python 2.x not python 3.x. See https://github.com/TooTallNate/node-gyp/issues/155 for more details.
3632* For 64 bit installs with 32 bit node
37- * you need the 32 bit JDK, with the 64 bit JDK you will see LNK2001
33+ * you need the 32 bit JDK, with the 64 bit JDK you will see LNK2001
3834 errormessages (http://stackoverflow.com/questions/10309304/what-library-to-link-to-on-windows-7-for-jni-createjavavm ).
3935 * when using the windows SDK 7.1 command prompt (64 bits) be sure to setenv.cmd /Release /x86
4036* If you see an error such as "Call to 'node findJavaHome.js' returned exit status 1"
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ process . env . PATH += require ( '../build/jvm_dll_path.json' ) ;
4+
35var path = require ( 'path' ) ;
46var binaryPath = path . resolve ( path . join ( __dirname , "../build/Release/nodejavabridge_bindings.node" ) ) ;
57var bindings = require ( binaryPath ) ;
Original file line number Diff line number Diff line change 2626 "url" : " https://github.com/joeferner/node-java.git"
2727 },
2828 "dependencies" : {
29- "find-java-home" : " 0.0.7"
29+ "find-java-home" : " 0.0.7" ,
30+ "glob" : " ~3.2.9"
3031 },
3132 "devDependencies" : {
3233 "nodeunit" : " ~0.6.4" ,
3334 "memwatch" : " ~0.2.0" ,
3435 "async" : " ~0.1.22"
3536 },
3637 "scripts" : {
37- "test" : " nodeunit test"
38+ "test" : " nodeunit test" ,
39+ "postinstall" : " node postInstall.js"
3840 },
3941 "main" : " ./index.js"
4042}
Original file line number Diff line number Diff line change 1+ var glob = require ( 'glob' ) ;
2+ var fs = require ( 'fs' ) ;
3+ var path = require ( 'path' ) ;
4+
5+ require ( 'find-java-home' ) ( function ( err , home ) {
6+ var dll ;
7+ var so ;
8+ var binary ;
9+
10+ if ( home ) {
11+ dll = glob . sync ( '**/jvm.dll' , { cwd : home } ) [ 0 ] ;
12+ so = glob . sync ( '**/libjvm.so' , { cwd : home } ) [ 0 ] ;
13+ binary = dll || so ;
14+
15+ fs . writeFileSync (
16+ path . resolve ( __dirname , './build/jvm_dll_path.json' ) ,
17+ binary
18+ ? JSON . stringify (
19+ path . delimiter
20+ + path . dirname ( path . resolve ( home , binary ) )
21+ )
22+ : '""'
23+ ) ;
24+ }
25+ } ) ;
You can’t perform that action at this time.
0 commit comments