How to include JavaScript file in Java program
问题 I have this script file created using phantomjs var webPage = require('webpage'); var page = webPage.create(); page.open(URL, function (status) { var content = page.content; console.log('Content: ' + content); phantom.exit(); }); now I want to use this script in a Java program but I can't. I do this in my project ScriptEngineManager s = new ScriptEngineManager(); ScriptEngine se = s.getEngineByName("JavaScript"); se.eval(new FileReader("myScript.js")); but `this is the result Exception in