JavaScript in Java

How to use javascript in java apps? There an example: // create a script engine manager ScriptEngineManager factory = new ScriptEngineManager(); // create a JavaScript engine ScriptEngine engine = factory.getEngineByName("JavaScript"); // evaluate JavaScript code from String Double obj = (Double)engine.eval("10.53*25.73/43.57"); // Any javascript command I use this solution in scrape application where some of values were as math expression.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here :