You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@forio.com> on 2006/04/24 06:34:09 UTC

Re: how to find vm location in a velocity application jar

Have you looked into the JarResourceLoader or (my favorite) the
ClasspathResourceLoader?

http://jakarta.apache.org/velocity/docs/developer-guide.html#Resource%20Loaders

WILL

On 4/23/06, Son Juhee <fo...@hotmail.com> wrote:
>
> hi,
>
> I'm developing a simple code-generator program using velocity.
> I'll distribute this as a jar (including java main- class and vm files )
> to
> developers.
> A problem is the location of vm files..
>
> generator.jar! main.java
>                     vm/ aaa.vm
>                            bbb.vm
>
> in this structure, how can I find the path of vm files?
>
> property.setProperty( "file.resource.loader.path", "../vm" );
> Velocity.init(property);
> => doesn't work.. it searches for the "where javaw executed"../vm  NOT
> INSIDE JAR!!
>
> I cannot use an absolute path, because vm files are inside jar and I don't
> even know where developers will put the jar  !!
>
> is there any way to use ../.. path to access vm files inside jar??
>
> please help.. any help will be appreciated!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


--
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Re: how to find vm location in a velocity application jar

Posted by Son Juhee <fo...@hotmail.com>.
Thanks,  Will!
I missed that part in the guide!!
I solved the problem by this:

            conf.setProperty( "resource.loader", "jar" );
            conf.setProperty( "jar.resource.loader.class", 
"org.apache.velocity.runtime.resource.loader.JarResourceLoader" );
            conf.setProperty( "jar.resource.loader.path", 
"jar:file:C:/myproject/lib/generator.jar" );


>From: "Will Glass-Husain" <wg...@forio.com>
>Reply-To: "Velocity Users List" <ve...@jakarta.apache.org>
>To: "Velocity Users List" <ve...@jakarta.apache.org>
>Subject: Re: how to find vm location in a velocity application jar
>Date: Sun, 23 Apr 2006 21:34:09 -0700
>
>Have you looked into the JarResourceLoader or (my favorite) the
>ClasspathResourceLoader?
>
>http://jakarta.apache.org/velocity/docs/developer-guide.html#Resource%20Loaders

>
>WILL
>
>On 4/23/06, Son Juhee <fo...@hotmail.com> wrote:
> >
> > hi,
> >
> > I'm developing a simple code-generator program using velocity.
> > I'll distribute this as a jar (including java main- class and vm files 
)
> > to
> > developers.
> > A problem is the location of vm files..
> >
> > generator.jar! main.java
> >                     vm/ aaa.vm
> >                            bbb.vm
> >
> > in this structure, how can I find the path of vm files?
> >
> > property.setProperty( "file.resource.loader.path", "../vm" );
> > Velocity.init(property);
> > => doesn't work.. it searches for the "where javaw executed"../vm  NOT
> > INSIDE JAR!!
> >
> > I cannot use an absolute path, because vm files are inside jar and I 
don't
> > even know where developers will put the jar  !!
> >
> > is there any way to use ../.. path to access vm files inside jar??
> >
> > please help.. any help will be appreciated!
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
>
>--
>Forio Business Simulations
>
>Will Glass-Husain
>wglass@forio.com
>www.forio.com



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