velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiano Vigna <>
Subject Re: Loading templates from classpath
Date Mon, 04 Apr 2005 10:24:16 GMT
On Wed, 2005-04-06 at 00:36 +0200, Sebastiano Vigna wrote:

> So the problem is open: how can I load a template from the jar from
> which the class is coming programmatically?

FINALLY, I got it working. It was somehow simpler than expected; my
fault 8^).

The properties you want to change must be passed to init(), or they are
useless. E.g., 

		Properties properties = new Properties();
		properties.setProperty( "resource.loader", "class" );
		properties.setProperty( "class.resource.loader.class", ClasspathResourceLoader.class.getName()
		Velocity.init( properties );

Once that is done, getTemplate( "the/full/path/in/the/jar" ) will work
(I thought the resource loader would have resolved relatively to the
loading class package).e:


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

View raw message