import java.io.*;
import java.util.Date;
import org.apache.velocity.*;
import org.apache.velocity.app.VelocityEngine;

public class VelocityDemo {

    public static void main(String [] args) throws Exception {
        VelocityEngine engine = new VelocityEngine();

        VelocityContext context = new VelocityContext();
        context.put("hello", "Hello World!");
        context.put("speaker", "Nathan");
        context.put("date", new Date());

        Template template = engine.getTemplate(args[0]);
        StringWriter out = new StringWriter();
        template.merge(context, out);

        System.out.println("---------------------------");
        System.out.println(out.toString());
    }

}

