title: "Exception in thread "main" java.lang.NullPointerException" when working with Apache POI, excel, and eclipse?
body: <p>Here is the snippet of my code:</p>
  
  <pre><code>public static String read1(int rowIndex, int colIndex) {
      String value = new String();
      HSSFWorkbook wb = null;
  
      try {
          wb = new HSSFWorkbook(new FileInputStream(Words1));
      } catch (Exception e) {
      }
  
      HSSFSheet sheet = wb.getSheet("SAT");
      HSSFRow row = sheet.getRow(rowIndex - 1);
      HSSFCell cell = row.getCell(colIndex - 1);
  
      DataFormatter formatter = new DataFormatter();
      value = formatter.formatCellValue(cell);
  
      return value;
  }
  </code></pre>
  
  <p>Then I have a main class that tells the program to use this method. The problem when I run it is 
  <code>"Exception in thread "main" java.lang.NullPointerException</code></p>
  
  <p>at Outline.read1(Outline.java:34)</p>
  
  <p>at Outline.main(Outline.java:55)"</p>
  
  <p>where line 34 is this(in the snippet above): </p>
  
  <pre><code>HSSFSheet sheet = wb.getSheet("SAT");
  </code></pre>
  
  <p>and line 55 is the part that tells the program to go to this method, which is: </p>
  
  <pre><code>String val=read1(rowIndex,colIndex);
  </code></pre>
  
  <p>I can't, for the life of me, find the reason why this won't run. Thanks!</p>