velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <>
Subject Re: Resource from a jar file
Date Sun, 14 Jun 2009 03:55:52 GMT
On Sat, Jun 13, 2009 at 6:48 PM, Mark Fenbers<> wrote:
> Nathan Bubna wrote:
>> I think org.apache.velocity.runtime.resource.loader.JarResourceLoader
>> was created to help with such situations.
> OK, I read up on JarResourceLoader() and put the appropriate resource loader
> entries into the file, but now I have a new problem in
> that if I am not using a Jar file, it dumps a stack trace.  My program can
> run from Eclipse, from a JVM, or from a jar file.  I want to avoid having a
> separate file for each way the program can be run.  Is
> there a way the file can be configured so that it
> doesn't matter if the program is run from a jar or from a JVM?

You can configure multiple resource loaders in a lookup order.

jar.resource.loader.class = ...
file.resource.loader.class = ...
whatever.resource.loader.class = ...

if Velocity can't find it via the jar one, it'll ask the file one,
then the whatever one, and so on until it runs out of loaders to ask.
Only then will it throw a ResourceNotFoundException.
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message