How to call a java event from Node JS?

3

I have a java application that connects to a biometric. The idea is to execute its functions from an app in node through Java. Is it possible to call this Java function from node? For example:

public static void llamando() {
    System.out.println("Hola Mundo");
}

When you press a button from Node:

 $('call_java_function').click(function(){
     llamando();
 });

Note: it's java desktop.

    
asked by Rastalovely 04.09.2017 в 16:27
source

1 answer

0

Ideally, you should expose a functionality that is called by console.

When the main method of a class is executed, it receives an array of String that contains the parameters that you can pass through the console

java -jar app.jar param1 param2 param3

and in the main this would be like that

public static void main(String[] params) {
    //params tendría ["param1", "param2", "param3"]
}

Knowing this you could call your method llamando() here starting from main and expose the results in a text file maybe so that your app consumes it in node.

    
answered by 04.09.2017 в 17:37