« Return to Thread: Resource from a jar file

Resource from a jar file

by Wxman :: Rate this Message:

Reply to Author | View in Thread

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@...
For additional commands, e-mail: user-help@...

 « Return to Thread: Resource from a jar file