Bridge API to connect with existing Java APIs.
Google Groups Discussion Forum
$ export JAVA_HOME=/usr/local/share/jdk1.6.0_30
$ npm install javaNotes:
- node-gyp requires python 2.x not python 3.x. See nodejs/node-gyp#155 for more details.
- If you see an error such as "No rule to make target '/opt/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so', needed by 'build/depsVerified'. Stop." this means that your JAVA_HOME is not set correctly and you need to verify the location of libjvm.so or jvm.lib.
- If you see an error such as "Error: The specified module could not be found. xxxxxx\node_modules\java\build\Release\nodejavabridge_bindings.node". 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). This path cannot have quotes.
$ npm install javaMavericks Users: If you are having problems finding 'jni.h' please see Issue #86
GYP_DEFINES="armv7=0" CCFLAGS='-march=armv6' CXXFLAGS='-march=armv6' npm install java./compile-java-code.sh
node-gyp configure build
npm testNOTE: You will need node-gyp installed using "npm install -g node-gyp"
var java = require("java");
java.classpath.push("commons-lang3-3.1.jar");
java.classpath.push("commons-io.jar");
var list = java.newInstanceSync("java.util.ArrayList");
java.newInstance("java.util.ArrayList", function(err, list) {
list.addSync("item1");
list.addSync("item2");
});
var ArrayList = java.import('java.util.ArrayList');
var list