Well... I think it depends on how complex your template is and how flexible you want your solution to be. You can simply open the template file and replace the values, writing it to another file. Classes from the API you may want to look at include FileReader, FileWriter, and String itself.
Or, you can use a 3rd party library for that. Apache Velocity is an example of one (although I haven't used it myself).