velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Fenbers <Mark.Fenb...@noaa.gov>
Subject Resource from a jar file
Date Sat, 13 Jun 2009 23:56:01 GMT
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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message