Search This Blog

Wednesday, February 3, 2010

Invoking Groovy Scripts in JAVA

import java.io.File;
import groovy.lang.Binding;
import groovy.util.GroovyScriptEngine;
public class ScriptEngineEmbedGroovy
{
public static void main(String args[]) throws Throwable
{
String[] paths = {"C:\\groovy"};
GroovyScriptEngine gse = new GroovyScriptEngine(paths);
Binding binding = new Binding();
Object[] path = {"C:\\music\\mp3"};
binding.setVariable("args",path);
gse.run("Songs.groovy", binding);
}
}

No comments:

Hit Counter


View My Stats