What would you say with I am not use correctly velocity? I want generate a code dinamically with some variables and for this I made getTemplate and pass the parameter. (the code that I put in the before comment)Exist any other way to do this? Or what I should do for use correctly velocity, because I don't understand you. My knowledge is that velocity let create a template and put parameter I this is wanna do, I belive that is use more for theme but I think it can be correct too.

Okay, if you actually read the velocity doco, you'll find that the getTemplate() method does not take a filesystem path. All it takes is a name. You use it like:

1tpl = Velocity.getTemplate("mytemplate.vm");

That's all.

The properties that you set control how the mytemplate.vm file is loaded.

If you use the file resource loader, the mytemplate.vm file will be searched for in the path you specify.

However, you are using the web resource loader. This attempts to find the mytemplate.vm file in the web app itself, and does not look externally in the filesystem for the template.

So you're not using it correctly because:

a) you're trying to pass a full path as the argument, and that's not supported.b) you want the template to come from the filesystem, but the properties you're using say to load it from the web app itself.