title: How to fix NoClassDefFoundError when using apache poi library?
body: <p>`I am trying to read a excel file. I am not sure what I am missing here. But I am getting error attached below. My variable book also shows that this variable is never used even though it is used in very next line. I assume it is related somehow but not sure how. 
  Any help is greatly appreciated.</p>
  
  <p>Error: Unable to initialize main class myExcelProject.MyExcelFileReader
  Caused by: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
  ` </p>
  
  <pre><code>package myExcelProject;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.Row;
  import org.apache.poi.ss.usermodel.Sheet;
  import org.apache.poi.ss.usermodel.Workbook;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class MyExcelFileReader {
      private String[][] inputs;
      private static String[][] excelInputs;
      private static Row row;
      private static Cell cell;   
  
      public static void main(String[] args) {
          try {
                  excelInputs=readExcelTable("Excel Report.xlsx");
              } catch (IOException e) {
                  e.printStackTrace();
              }       
  
      }
  
      public static String[][] readExcelTable(String excelFile) throws IOException{
  
          FileInputStream inputStream = new FileInputStream(new File(excelFile));
          Workbook book = new XSSFWorkbook(inputStream);
          Sheet firstSheet = book.getSheetAt(0);
          int lastRowNum = firstSheet.getLastRowNum();
  
          String[][] excelReadout = new String[lastRowNum][4];
          for (int i = 3; i &lt; lastRowNum; i++) {
              row = firstSheet.getRow(i);
              if (row == null) {
              } else {
                  for (int j = 0; j &lt; 4; j++) {
                      cell = row.getCell(j, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL);
                      if (cell == null) {
                          // do nothing
                      } else {
                          excelReadout[i][j]=cell.toString();
                          //System.out.print(cell.toString());
                      }
                  }
                  System.out.println();
              }
          }
          return excelReadout;
      }
  
  } 
  </code></pre>