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 00:07:41 GMT
I think org.apache.velocity.runtime.resource.loader.JarResourceLoader
was created to help with such situations.

On Sat, Jun 13, 2009 at 4:56 PM, Mark Fenbers<> wrote:
> I'm having some trouble with mergeTemplate() in that it seems to be unable
> to open a template file if it is packaged in a jar file.  In my Java code, I
> use getResource("resources/velocity.template").getFile() [from the "Class"
> object] to expand the relative location to a full URL.  This is for
> flexibility/portability...  This approach works fine when *not* running my
> app from a Jar file because the file name expands to a simple path,
> something like: "/home/mark/resources/velocity.template" whereas when run
> from a Jar file, it expands to something like:
> "file:/home/mark/MyApp.jar!/resources/velocity.template", and thus
> mergeTemplate doesn't like this format... probably the "file:" or the "!"
> throw it off.
> I'm not sure how to get past this hurdle.  Any ideas?
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message