Below is a trivial way to run Javascript in java:
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine jsEngine = mgr.getEngineByName("JavaScript");
try {
jsEngine.eval("print('Hello, world!')");
} catch (ScriptException ex) {
ex.printStackTrace();
}
The question would be, if I run this with AppEngine (and perhaps bigger JS that could take very long time to finish), will there be any issues with regards to the processing time limit imposed by the platform (in the front-end process), should I run this on AppEngine process that won’t get terminated? To the back-end? How?
Yes there’s pretty strict time limits on front end processing. You would have to do this processing on a backend or use a Task Queue task to kick off the operation. Task Queue tasks have a 10 minute time limit.
Frankly though, I would recommend against using App Engine for this purpose. Your javascript code would probably run a lot faster in node.js than in the Java interpreter. Find a service that can host node.js, and run this portion of your app on that service. You’ll probably need far fewer instance hours and save a bunch of money that way.