How to call javascript function making a axios api call from java

201 Views Asked by At

I have a javascript function which make a network call using the axios library. The function supports for GET and POST. My requirement is to call the same javascript function from Java, which internally will make a network call using axios.

1

There are 1 best solutions below

1
On

You can create a node.js application that uses the axios library to accomplish what you need and call it from Java with code similar to this:

Runtime run  = Runtime.getRuntime();
run.exec(command);

That said, Java has excellent libraries for networking to probably fit your requirement.