title: Non-static variable of cannot be referenced from a static context
body: <p>I'm trying to call my <code>createFile</code> method from the <code>OpenFile</code> class in my main method, but I keep getting the error saying that I cannot call a non-static variable from a static context.</p>
  
  <p>I did try calling <code>OpenFile of = new OpenFile();</code> inside my main method, but that didn't work so I'm currently declaring <code>OpenFile</code> above my main method which works fine, however every time I try to use one of <code>OpenFile</code>s methods I get the same error.</p>
  
  <p>I've tried prefacing a few things with <code>static</code> but that just causes my IDE to show an Erroneous sym type error, which I think is caused by whatever is causing the other error.</p>
  
  <p>Here is <code>createFile</code> from <code>OpenFile</code>:</p>
  
  <pre><code>public class OpenFile {
  
      private Formatter file;
  
      public void createFile() throws FileNotFoundException{
  
          try{
              file = new Formatter("test.txt");
          } catch(Exception e) {
              System.out.println("Error creating file.");
      }
      }
  </code></pre>
  
  <p>and here is my main method:</p>
  
  <pre><code>OpenFile of = new OpenFile();
  
  public static void main(String[] args) {
      // TODO code application logic here
  
      of.createFile();
      intro();
      createAndShowRibbon();
      createAndShowNormalUI();
  
  }
  </code></pre>
  
  <p>Is it something to do with Formatter? I've never used it before.</p>
  
  <p>Thanks.</p>