title: Importing freemarker macros
body: <p>My <code>macros.txt</code> file is</p>
  
  <pre><code>&lt;#macro macro1&gt;
  Helloworld.
  &lt;/#macro&gt;
  </code></pre>
  
  <p>I have another file <code>testMacro.txt</code>. I want to use this macro inside the file <code>testMacro.txt</code>. 
  I have tried the following</p>
  
  <pre><code>&lt;#import "./macros.txt" as my&gt;
  &lt;@my.macro1 /&gt;
  </code></pre>
  
  <p>But it does not seem to be working. </p>
  
  <p>In my java file, where I am working with the template file, I have(in my MacroWorking.java)</p>
  
  <pre><code>template = new Template(null,new FileReader("testMacro.txt"),new configuration());
  </code></pre>
  
  <p>Exception are. </p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
  at freemarker.core.LibraryLoad.&lt;init&gt;(LibraryLoad.java:82)
  at freemarker.core.FMParser.Import(FMParser.java:1727)
  at freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2389)
  at freemarker.core.FMParser.Content(FMParser.java:2618)
  at freemarker.core.FMParser.OptionalBlock(FMParser.java:2786)
  at freemarker.core.FMParser.Root(FMParser.java:2958)
  at freemarker.template.Template.&lt;init&gt;(Template.java:149)
  at freemarker.template.Template.&lt;init&gt;(Template.java:172)
  at msjava.hdom.examples.DbQuery.main(MacroWorking.java:24)
  </code></pre>
  
  <p>Line 24 of MacroWorking.java is the one given above.</p>
  
  <p>EDIT: With the same code but with my <code>testMacro.txt</code> having text as <code>HELLOWORLD</code> only, i.e. no import statement, then it works fine.
  What do I do?
  Thanks.</p>