Results 1 to 1 of 1

Thread: Hi

  1. #1
    trilochan is offline Member
    Join Date
    Sep 2009
    Rep Power

    Default Hi

    Hi, I didnt know where to post this msg. So here it is. I am trying to write a velocity template program using eclipse. Here's the code:
    package velocityExample;


    import org.apache.velocity.Template;
    import org.apache.velocity.VelocityContext;

    public class HelloWorld {
    public static void main( String[] args )
    throws Exception {
    VelocityEngine ve = new VelocityEngine();
    Template t = new Template();
    VelocityContext context = new VelocityContext();
    context.put("name", "World");
    StringWriter writer = new StringWriter();
    t.merge( context, writer );
    System.out.println( writer.toString() );
    The template file "helloworld.vm" is present in the same folder.
    But still it shows a error
    Exception in thread "main" org.apache.velocity.exception.ResourceNotFoundExce ption: Unable to find resource 'helloworld.vm'
    at org.apache.velocity.runtime.resource.ResourceManag erImpl.loadResource(
    at org.apache.velocity.runtime.resource.ResourceManag erImpl.getResource(
    at org.apache.velocity.runtime.RuntimeInstance.getTem plate(
    at org.apache.velocity.runtime.RuntimeInstance.getTem plate(
    at (
    at velocityExample.HelloWorld.main( )
    Please help. ( I have tried by giving the absolute path also.)
    Last edited by trilochan; 09-04-2009 at 11:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts