How do I take output from a java class?

I my web application using Meteor framework, I have to supply an input, compute it and take output from a java class. Can I do it or I need to “translate” from java class to javascript ? Thanks

Javascript and Java cannot interoperate by default. You can either try to find a javascript based alternative of your Java code, or re-code it in Javascript. If neither of these are really options, then you could look into wrapping your Java based code in a web service (so potentially create a simple servlet running in a container like Tomcat somewhere), then have your Meteor based app communicate with that Java/servlet based web service.

2 Likes

if that’s a java executable and you have the jre installed, you can execute it and read the result on the shell

node has shell access and there are packages like shelljs that make this easy and cross platform for you

edit:
I also just found https://www.npmjs.com/package/java which looks very interesting!

2 Likes