public static void main(String[] args) throws ScriptException, FileNotFoundException, NoSuchMethodException {
        ScriptEngine engine = new ScriptEngineManager().getEngineByName("javascript");
        
        engine.eval(new FileReader("G:\\tmp\\test.js"));
        
        if(engine instanceof Invocable){
            Invocable in = (Invocable)engine;
            
            Double result = (Double)in.invokeFunction("add", 100.0,200.0);
            
            System.out.println("Result:"+result);
        }
    }

 

相关文章:

  • 2022-01-23
  • 2021-11-17
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2021-12-06
  • 2021-07-24
  • 2022-02-09
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2021-11-29
  • 2022-01-07
  • 2021-12-27
  • 2021-08-29
  • 2021-11-22
相关资源
相似解决方案