velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Oliver Nutter <>
Subject Re: Unable to locate .VM files in Jar (Velocity 1.3.1)
Date Thu, 30 Oct 2003 22:03:20 GMT
1. Specify the full path to the template. If it's contained within a jar 
in the path my/path/to/template, you'd prepend that path to the name of 
the template file.
2. If you are loading Velocity in one classloader (like at the system 
level) and trying to access the template within another classloader 
(like at the EJB container level) you'll need to implement your own 
ClasspathResourceLoader that uses 
Thread.currentThread().getContextClassLoader() instead of 
getClass().getClassLoader(). There's a bug on this at

- Charlie wrote:

>I have a project setup in JBuilder With a structure that looks something
>like this:
>  -contains class files
>  -contains all the .VM Files
>  -contains properties files
>I create a runnable jar by including the above, plus the entire velocity
>package (with dependencies).
>The program is unable to locate the .VM Files.
>I've tried varies setting for the resource loader - including the
>resource.loader=classpath, file,jar
>file.resource.loader.path=./templates, templates, /templates,
>templates.jar was another attempt - but the VM files are located in the
>com/company/tool/generator/templates path - so Velocity is unable to find
>It seems the only way I can get to my Template (VM) files is if I move them
>out of the jar where the 'file' resource can see them, or put them in the
>root of my jar - which is really messy.
>Could the jar resource loader be extended so something like this:
>could happen?
>or is there another way to accomplish what I'm looking for?
>Thank you,
>This communication may contain information that is legally privileged, confidential, or
exempt from disclosure.  If you are not the intended recipient, please note that any dissemination,
distribution, or copying is strictly prohibited.  If you have received this message in error
please notify the sender by telephone, fax, or return email and delete this message from your
computer.  Thank you.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message