import java.io.*;
import java.util.*;
import freemarker.template.*;
public class HelloFreemarker {
public static void main(String[] args)
throws IOException, TemplateException {
Configuration cfg = new Configuration();
cfg.setObjectWrapper(new DefaultObjectWrapper());
cfg.setDirectoryForTemplateLoading(new File("."));
Map<String, Object> model = new HashMap<String, Object>();
model.put("name", "World");
Template template = cfg.getTemplate("hello.ftl");
template.process(model,
new OutputStreamWriter(System.out));
}
}
hello ${name}!
我使用Freemarker模板编写了一个Java程序,但在尝试编译/构建程序时出现配置错误。一条消息显示配置已过时。我正在使用JDK 8和JRE 8,并使用Eclipse Neon作为我的IDE。请帮助我执行该程序。