title: How to call public Java variable in FreeMarker
body: <p>I'm trying to call a Java method in my FreeMarker template that uses a public static Java variable as one of its parameters. For example, if the FreeMarker code in a <code>test.ftl</code> is this:</p>
  
  <pre><code>${javaClass.getSomething(javaClass.VARIABLE)}
  </code></pre>
  
  <p>and if the class <code>JavaClass</code> looks like this:</p>
  
  <pre><code>public class JavaClass {
  
      public static final int VARIABLE = 1;
  
      public String getSomething(int var) {
      ...
      }
  </code></pre>
  
  <p>I receive errors when using the template that look like this:</p>
  
  <p><code>
       [echo] Expression JavaClass is undefined on line 40, column 81 in com/test/template/path/test.ftl.
       [echo] The problematic instruction:
       [echo] ----------
       [echo] 03:53:01,146 ERROR [main][runtime:96] Template processing error: "Expression JavaClass is undefined on line 40, column 81 in com/test/template/path/test.ftl"
       [echo]
       [echo] ==&gt; ${javaClass.getSomething(javaClass.VARIABLE)} [on line 40, column 25 in com/test/template/path/test.ftl] Expression JavaClass is undefined on line 40, column 81 in com/test/template/path/test.ftl.
       [echo]
       [echo] ----------The problematic instruction:
       [echo]
       [echo]
       [echo] ----------
       [echo] Java backtrace for programmers:
       [echo] ----------
       [echo] ==&gt; ${javaClass.getSomething(javaClass.VARIABLE)} [on line 40, column 25 in com/test/template/path/test.ftl]freemarker.core.InvalidRe
  ferenceException: Expression JavaClass is undefined on line 40, column 81 in com/test/template/path/test.ftl.
  ...
  ...
  </code></p>
  
  <p>This error is complaining that it doesn't like the <code>javaClass.VARIABLE</code> and throws the <code>InvalidReferenceException</code>. I've tried specifying this in other different ways, such as <code>JavaClass.VARIABLE</code>, <code>${javaClass.VARIABLE}</code>, and <code>${JavaClass.VARIABLE}</code>, but they all throw errors.</p>
  
  <p>How would you call a public Java variable from within a Java method in a FreeMarker (.ftl) template?</p>