You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Michael Yui <yc...@sympatico.ca> on 2004/07/23 22:04:46 UTC

Problems loading template from a file on my Windows files system


Hi,

I can load templates from the classpath but not from a file. Please tell me 
what I'm doing wrong.

I'm using this as the template string when calling mergeTemplate()

"c:\\output\\testSheets.vm"

and I get this error:

  org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource 'c:\output\testSheets.vm'

here are the properties I'm using to initialize Velocity.

          Properties props = new Properties();
          props.put("resource.loader", "file, class");
          props.put("file.resource.loader.description", "Velocity File 
Resource Loader");
          props.put("file.resource.loader.class", 
"org.apache.velocity.runtime.resource.loader.FileResourceLoader");
          props.put("file.resource.loader.path", ".");
          props.put("file.resource.loader.cache", "true");
          props.put("file.resource.loader.modificationCheckInterval", "0");
          props.put("class.resource.loader.description", "Velocity 
Classpath Resource Loader");
          props.put("class.resource.loader.class", 
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
          props.put("class.resource.loader.cache", "true");
          props.put("class.resource.loader.modificationCheckInterval", "0");
          Velocity.init(props);



-- 
Best regards,
  Michael




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org