I am developing a node application from which I need to execute java code.
I am using the module: node-jre ( link ).
The example that comes on the page (Hello.class) works well with the code that comes on the page (I include it here) but compiled the class by console with: javac Hello.java :
var output = jre.spawnSync( // call synchronously
['java'], // add the relative directory 'java' to the class-path
'Hello', // call main routine in class 'Hello'
['World'], // pass 'World' as only parameter
{ encoding: 'utf8' } // encode output as string
).stdout.trim();
The problem comes when I try to execute a project that I created in eclipse. The documentation says that in the directory 'java' it looks in the jar files, so I tried to export the project as .jar, but it does not work, it seems that it does not find the main class that is what happened to it.
So, that's the question, how can I do to run my java project with node-jre?
I think it's important to say that the project has external libraries and also a single package with 7 classes of which only one is the main one (it has the main method).