Thank you Simon,

OK for that
                java.util.Properties oProperties = new Properties();
                oProperties.setProperty("resource.loader", "jar");
                oProperties.setProperty("jar.resource.loader.path",
"c:\\Wokup\\lib\\foo.jar");
                Velocity.init(oProperties);


But i have this error :

Unable to find resource 'foo.tpl'

when i execute the following code

          try
         {
                oTemplate = Velocity.getTemplate("foo.tpl");
                oTemplate.merge(getVelocityContext(), oBufferedWriter);
                oBufferedWriter.flush();
           }
           catch(Exception oE)
           {
                throw new InternalWokException(oE.getMessage());
           }


--
Pierre-François Lemosquet


Simon Christian wrote:

> Hi,
>
> You need to use the JarResourceLoader instead of the FileResourceLoader.
> This should be simply a matter of changing a couple of lines, to
> something like:
>
> java.util.Properties oProperties = new Properties();
> oProperties.setProperty("resource.loader", "jar");
> oProperties.setProperty("jar.resource.loader.path", "c:\\temp\foo.jar");
> Velocity.init(oProperties);
> Template oTemplate = Velocity.getTemplate("foo.tpl");
>
> Check the Resource Management section in the developer-guide for more
> detail.
>
> - simon
>
> Pierre-François Lemosquet wrote:
> >
> > Hi!
> >
> > I use a template located in c:\temp\foo.tpl
> >
> >  java.util.Properties oProperties = new Properties();
> >  oProperties.setProperty("file.resource.loader.path", "c:\\temp");
> >  Velocity.init(oProperties);
> >  Template oTemplate = Velocity.getTemplate("foo.tpl");
> >
> > But, how to do to use a template which is located in a jar  ?
> >





Reply via email to