Can I call a Java program from a Node.js application on Heroku?
I have a Node.js / Heroku application. But now you need to add the server ability to run the algorithm on the input data file and output the data in JSON format. I already have a Java library that can read the file and run the algorithm, and it would be very difficult (at best) to rewrite it in its pure form Node.js.
So, you can write a command-line program that takes an input file and passes the results to stdout, for example.
java mytask.class -cp ./mylibrary.jar --in /tmp/file.in > output.json
Is it possible to output a call to the Java command line program from Node.js? I know that you can deploy Java applications to Heroku, but here you need to run a bit of Java from the Node.js. application.
source share