//#1、用scriptEngineManger
ScriptEngineManager engine=new ScriptEngineManager();
//#2、获取scriptEngine对象
ScriptEngine jsEngine= engine.getEngineByName("nashorn");
//#3、调用eval函数执行脚本
jsEngine.eval("load('service/service.js')");
jsEngine.eval("post()");