title: non-static method cannot be referenced from a static context
body: <p>I would like to understand this once and for all.</p>
  
  <p>With this please excuse the mass of code pasted below, but I do not want to leave out any details.</p>
  
  <p>The only thing I changed is the URL loaded. But this is not causing the error.</p>
  
  <p>I would like to call my function "<strong>readPosiitons</strong>". Easy solution, make it static. Real solution, I am not sure of.</p>
  
  <p>Please help me to better understand how to solve this error in the correct way.</p>
  
  <p>Thanks!!</p>
  
  <pre><code>            /*
               * To change this template, choose Tools | Templates
               * and open the template in the editor.
               */
  
              package PandL;
  
              import java.io.BufferedReader;
              import java.io.File;
              import java.io.IOException;
              import java.io.InputStreamReader;
              import java.net.MalformedURLException;
              import java.net.URL;
              import java.util.HashMap;
              import java.util.Scanner;
              import toolBox.Secretary;
              import toolBox.Secretary.positionObj;
  
              /**
               *
               * @author Jason
               *
               */
              public class GarageComm {
                  public static void main(String[] args) throws MalformedURLException, IOException{
                      String retStr;
                      String startM;
                      String endM;
                      String myURL;
                      String[] Split1=null;
                      Integer lnCount;
                      HashMap hashPos=new HashMap();
                      hashPos= readPositions("holdingsBU.txt");//the error is here
  
                      myURL="http://myUrl?s=";
  
                      URL url = new URL(myURL);
                      BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
  
  
  
                      in.close();
                  }
  
                  public HashMap readPositions(String destFile){
  
                      HashMap&lt;String, Secretary.positionObj&gt; hashPositions=new HashMap&lt;String,positionObj&gt;();
                      Secretary mySecretary=new Secretary();
                      try{
                          File F=new File(destFile);
                          if(F.exists()){
                              System.out.println("File Exists: "+F.exists());
                              System.out.println(destFile);
                              Scanner sC= new Scanner(F);
  
                              while (sC.hasNext()){
                                  String[] Splitter1;
                                  Secretary.positionObj position=mySecretary.new positionObj();
  
  
                                  Splitter1=sC.nextLine().split(",");
                                  position.positionDate=Double.parseDouble(Splitter1[0]);
                                  position.positionTicker=(Splitter1[1]);
                                  position.positionOpen=Double.parseDouble(Splitter1[2]);
                                  position.positionPrice=Double.parseDouble(Splitter1[3]);
                                  position.positionSMA=Double.parseDouble(Splitter1[4]);
                                  position.positionUpdated=Double.parseDouble(Splitter1[5]);
                                  position.priceUpdated=Double.parseDouble(Splitter1[6]);
                                  position.updateDate=Double.parseDouble(Splitter1[7]);
  
  
                                  hashPositions.put(position.positionTicker.trim(), position);
  
                              }
  
  
                          }else{
                              System.out.println("File Created: "+ F.createNewFile());
                              System.out.println("----No previous positions----");
                          }
  
                      }catch (Exception E){
                          System.err.println(destFile + " does not exist.");
                          hashPositions.put("ERROR", null);
                          E.printStackTrace();
                      }
                      return hashPositions;
                  }
              }
  </code></pre>