The ClasspathResourceLoader will let you load resources like .vm templates and other resources like include files, etc. from jars in the classpath, but the properties file for velocity needs to be at the root of the jar or in your /classes directory if on Tomcat. It isn't finding the properties file that sets the ClasspathResourceLoader. Carts aren't pushed by horses...;-)
Michael Oliver CTO Alarius Systems LLC 6800 E. Lake Mead Blvd, #1096 Las Vegas, NV 89156 Phone:(702)643-7425 Fax:(702)974-0341 *Note new email changed from [EMAIL PROTECTED] -----Original Message----- From: Cliff Meyers [mailto:[EMAIL PROTECTED] Sent: Friday, August 12, 2005 9:24 AM To: [email protected] Subject: Re: locating Velocity templates in a .jar Mike gave me some more details on this but I'm still having trouble getting it to work. If I add a velocity.properties file in my jar like so: com/company/division/uitools/velocity.properties It doesn't appear to be getting read at all. I was thinking of trying to set the ClassPathResourceLoader manually in my code but there doesn't appear to be a constant in the Velocity class. Can anyone else provide an assist? Thanks so much... -Cliff On 8/10/05, Michael Oliver <[EMAIL PROTECTED]> wrote: > You can google "Velocity ClassPathResourceLoader" and get all the details > you can stand. > > But this page is the best. > > http://jakarta.apache.org/velocity/docs/developer-guide.html#Configuring%20R > esource%20Loaders > > > Michael Oliver > CTO > Alarius Systems LLC > 6800 E. Lake Mead Blvd, #1096 > Las Vegas, NV 89156 > Phone:(702)643-7425 > Fax:(702)974-0341 > *Note new email changed from [EMAIL PROTECTED] > > -----Original Message----- > From: Cliff Meyers [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 10, 2005 12:34 PM > To: [EMAIL PROTECTED] > Subject: Re: locating Velocity templates in a .jar > > Wow, thank you for the super fast response! :) I am an extreme newbie > with respect to Velocity (and Java in general) so can I ask you a > follow up? What do I need to put into my velocity.properties file to > get this to work? I found this Class in the Velocity API docs but it > wasn't super clear how to actually use it... thanks again!! > > > On 8/10/05, Michael Oliver <[EMAIL PROTECTED]> wrote: > > Ah ha! Use the ClassPathResourceLoader instead of the default > > FileResourceLoader and make sure your jar is in the classpath and if the > > location of the templates in the jar is > > /com/yourpackage/templates/....blahblay.vm > > > > Your reference to it should be com/yourpackage/templates/...blahblay.vm > > > > It took me two days to figure that out....just slow I guess, I hope this > > helps you do it faster. > > > > Michael Oliver > > CTO > > Alarius Systems LLC > > 6800 E. Lake Mead Blvd, #1096 > > Las Vegas, NV 89156 > > Phone:(702)643-7425 > > Fax:(702)974-0341 > > *Note new email changed from [EMAIL PROTECTED] > > -----Original Message----- > > From: Cliff Meyers [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, August 10, 2005 12:16 PM > > To: [email protected] > > Subject: locating Velocity templates in a .jar > > > > I wrote a single class that is used to generate UI for our web > > applications. I wanted to package this class in a .jar along with the > > two velocity templates it depends on. Unfortunately I can't get this > > call in my class to work: > > > > Template template = Velocity.getTemplate(templateFile); > > > > Is there something I can set in the properties file > > (file.resource.loader.path) that will assist me here? Is the approach > > even possible? Thanks so much for your help! > > > > > > -Cliff Meyers > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
