[Solved] Combine Node.js and Java?


If you have a node.js-based web application, through which you get the data for further processing, but your actual algorithms are written in Java, node-java may be a way to go.

node-java is a bridge between node.js and java code, and allows you to instantiate java objects, manipulate them and call methods on them.

You can find examples on how to do that on project page, here’s a simple snippet demonstrating what you can do:

var java = require("java");

java.classpath.push('path/to/myAwesomeLibrary.jar');
java.classpath.push('target/classes');

java.newInstance("my.awesome.library.DataProcessor", function(err, dataProcessor) {
    dataProcessor.processSomeData("myData");
});

5

solved Combine Node.js and Java?