Search This Blog

Showing posts with label Invoking Groovy Scripts java. Show all posts
Showing posts with label Invoking Groovy Scripts java. Show all posts

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);
}
}

Hit Counter


View My Stats