Below is structure of my Jar
file
root
- template.ftl
- org.project.myproject.App.java
Inside App.java, I have a line of code that expects me to specify the directory
for loading the template.ftl
. Something like:
Line#1: cfg.setDirectoryForTemplateLoading("java.io.File object that represents /directory/for/storing/template/files");
and the next line of code, read the template file
Line#2: Template temp = cfg.getTemplate("template.ftl");
My problem is that I'm not able to specify the path of directory from where the file will be loaded. The template file to load is available in root of the Jar
. When I write,
cfg.setDirectoryForTemplateLoading(new File("."));
It says, template.ftl
not found.
What should be apprpriate code that can set the template directory correctly at Line#1
above?