Execute Groovy from Java


/ Published in: Java
Save to your folder(s)

setPropertyしたオブジェクトは、Groovyから宣言済みの変数として参照できる。


Copy this code and paste it in your HTML
  1. GroovyShell shell = new GroovyShell();
  2. Script script = shell.parse(new File(SCRIPT_FILE));
  3. script.setProperty("score1", score1);
  4. script.setProperty("score2", score2);
  5. Object ret = script.run();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.