title: Exception In Initializer caused by NullPointerException
body: <p>I'm running the Lip reading code on Eclipse Indigo from the following link: <a href="https://github.com/sagioto/LipReading/blob/master/lipreading-core/src/main/java/edu/lipreading/vision/NoMoreStickersFeatureExtractor.java" rel="nofollow noreferrer">https://github.com/sagioto/LipReading/blob/master/lipreading-core/src/main/java/edu/lipreading/vision/NoMoreStickersFeatureExtractor.java</a></p>
  
  <p>The code is: </p>
  
  <pre><code>package edu.lipreading.vision;
  
  import static com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U;
  import static com.googlecode.javacv.cpp.opencv_core.cvCircle;
  import static com.googlecode.javacv.cpp.opencv_core.cvClearMemStorage;
  import static com.googlecode.javacv.cpp.opencv_core.cvCreateImage;
  import static com.googlecode.javacv.cpp.opencv_core.cvGetSeqElem;
  import static com.googlecode.javacv.cpp.opencv_core.cvLoad;
  import static com.googlecode.javacv.cpp.opencv_core.cvResetImageROI;
  import static com.googlecode.javacv.cpp.opencv_core.cvSetImageROI;
  import static com.googlecode.javacv.cpp.opencv_core.cvSize;
  import static com.googlecode.javacv.cpp.opencv_imgproc.CV_COUNTER_CLOCKWISE;
  import static com.googlecode.javacv.cpp.opencv_imgproc.CV_RGB2GRAY;
  import static com.googlecode.javacv.cpp.opencv_imgproc.cvCvtColor;
  import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_FIND_BIGGEST_OBJECT;
  import static com.googlecode.javacv.cpp.opencv_objdetect.cvHaarDetectObjects;
  
  import java.io.File;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.PrintStream;
  import java.util.Arrays;
  import java.util.List;
  import java.util.Vector;
  import java.util.concurrent.*;
  import java.util.concurrent.atomic.AtomicInteger;
  
  import org.apache.commons.math3.linear.Array2DRowRealMatrix;
  import org.apache.commons.math3.linear.RealMatrix;
  
  import com.googlecode.javacpp.Loader;
  import com.googlecode.javacv.cpp.opencv_core.CvMat;
  import com.googlecode.javacv.cpp.opencv_core.CvMemStorage;
  import com.googlecode.javacv.cpp.opencv_core.CvPoint;
  import com.googlecode.javacv.cpp.opencv_core.CvRect;
  import com.googlecode.javacv.cpp.opencv_core.CvScalar;
  import com.googlecode.javacv.cpp.opencv_core.CvSeq;
  import com.googlecode.javacv.cpp.opencv_core.IplImage;
  import com.googlecode.javacv.cpp.opencv_objdetect;
  import com.googlecode.javacv.cpp.opencv_objdetect.CvHaarClassifierCascade;
  
  import edu.lipreading.Constants;
  import edu.lipreading.Utils;
  
  /**
   * This FeatureExtractor extracts lip coordinates automatically by identifying user lips.
   */
  public class NoMoreStickersFeatureExtractor extends AbstractFeatureExtractor{
          private static final int RECT_VERTICAL_JUMP = 10;
          private static final int RECT_FRAME_THRESHOLD = 5;
          private final ExecutorService executor = Executors.newCachedThreadPool();
          private IplImage manipulated;
          private CvRect prev = new CvRect();
      private CvHaarClassifierCascade classifier;
          private CvMemStorage storage;
      private int sideConfidence;
          private int lowerConfidence;
          private int upperConfidence;
          private int rectFrameCount = 0;
  
          public List&lt;Integer&gt; getPoints(IplImage grabbed) throws Exception {
          int roiFix = grabbed.height() / -32;
                  sideConfidence = grabbed.width() / 128;
                  lowerConfidence = grabbed.height() / 128;
                  upperConfidence = grabbed.width() / 32;
  
                  if(manipulated == null)
                          manipulated = cvCreateImage(cvSize(grabbed.width(), grabbed.height()), IPL_DEPTH_8U, 1);
                  if(storage == null || classifier == null)
                          init();
                  cvClearMemStorage(storage);
                  cvCvtColor(grabbed, manipulated, CV_RGB2GRAY);
                  CvSeq mouths = cvHaarDetectObjects(manipulated, classifier, storage, 1.8, 13, CV_HAAR_FIND_BIGGEST_OBJECT);
                  CvRect r = new CvRect(cvGetSeqElem(mouths, 0));
                  if(r.isNull()){
                          return null;
                  } else if (prev.y() != 0 &amp;&amp; rectFrameCount &lt; RECT_FRAME_THRESHOLD){
                          if (Math.abs(r.y() - prev.y()) &gt; RECT_VERTICAL_JUMP){
                                  CvRect.memcpy(r, prev, prev.sizeof());
                                  rectFrameCount++;
                          }
                  } else if (rectFrameCount &gt;= RECT_FRAME_THRESHOLD){
                          rectFrameCount = 0;
                  }
                  CvRect.memcpy(prev, r, r.sizeof());
                  r.y(r.y() + roiFix);
                  final int x = r.x(), y = r.y();
                  cvSetImageROI(grabbed, r);
                  final CvMat mat = grabbed.asCvMat();
  
                  List&lt;Future&lt;int[]&gt;&gt; points = new Vector&lt;Future&lt;int[]&gt;&gt;();
                  final Future&lt;double[][]&gt; getH = executor.submit(new Callable&lt;double[][]&gt;() {
                          @Override
                          public double[][] call() throws Exception {
                                  return getH(mat);
                          }
                  });
                  final Future&lt;double[][]&gt; getL = executor.submit(new Callable&lt;double[][]&gt;() {
                          @Override
                          public double[][] call() throws Exception {
                                  return getL(mat);
                          }
                  });
                  final Future&lt;double[][]&gt; getLmini = executor.submit(new Callable&lt;double[][]&gt;() {
                          @Override
                          public double[][] call() throws Exception {
                                  return Lmini(getL.get());
                          }
                  });
                  final Future&lt;int[]&gt; getRight = executor.submit(new Callable&lt;int[]&gt;() {
                          @Override
                          public int[] call() throws Exception {
                                  return getRight(getL.get(), getLmini.get());
                          }
                  });
                  points.add(getRight);
                  final Future&lt;int[]&gt; getLeft = executor.submit(new Callable&lt;int[]&gt;() {
                          @Override
                          public int[] call() throws Exception {
                                  return getLeft(getL.get(), getLmini.get());
                          }
                  });
                  points.add(getLeft);
                  final Future&lt;int[]&gt; getUpper = executor.submit(new Callable&lt;int[]&gt;() {
                          @Override
                          public int[] call() throws Exception {
                                  return getUpper(getL.get(), getH.get(), getRight.get()[0], getLeft.get()[0]);
                          }
  
                  });
                  points.add(getUpper);
                  final Future&lt;int[]&gt; getLower = executor.submit(new Callable&lt;int[]&gt;() {
                          @Override
                          public int[] call() throws Exception {
                                  return getLower(getL.get(), getUpper.get()[0]);
                          }
                  });
                  points.add(getLower);
  
                  List&lt;Integer&gt; frameCoordinates = new Vector&lt;Integer&gt;();
  
                  for (Future&lt;int[]&gt; point : points) {
                          int coordinateX = point.get()[0] + x, coordinateY = point.get()[1] + y;
                          frameCoordinates.add(coordinateX);
                          frameCoordinates.add(coordinateY);
                  }
                  cvResetImageROI(grabbed);
                  //cvRectangle(grabbed, cvPoint(x, y), cvPoint(x+r.width(), y+r.height()), CvScalar.GREEN, 1, CV_AA, 0);
                  return frameCoordinates;
          }
  
  
     /* public List&lt;Integer&gt; getPointsSingleThreaded(IplImage grabbed) throws Exception {
          int roiFix = grabbed.height() / -32;
                  sideConfidence = grabbed.width() / 128;
                  lowerConfidence = grabbed.height() / 128;
                  upperConfidence = grabbed.width() / 32;
  
                  if(manipulated == null)
                          manipulated = cvCreateImage(cvSize(grabbed.width(), grabbed.height()), IPL_DEPTH_8U, 1);
                  if(storage == null || classifier == null)
                          init();
                  cvClearMemStorage(storage);
                  cvCvtColor(grabbed, manipulated, CV_RGB2GRAY);
                  CvSeq mouths = cvHaarDetectObjects(manipulated, classifier, storage, 1.8, 13, CV_HAAR_FIND_BIGGEST_OBJECT);
                  CvRect r = new CvRect(cvGetSeqElem(mouths, 0));
                  if(r.isNull()){
                          return null;
                  } else if (prev.y() != 0 &amp;&amp; rectFrameCount &lt; RECT_FRAME_THRESHOLD){
                          if (Math.abs(r.y() - prev.y()) &gt; RECT_VERTICAL_JUMP){
                                  CvRect.memcpy(r, prev, prev.sizeof());
                                  rectFrameCount++;
                          }
                  } else if (rectFrameCount &gt;= RECT_FRAME_THRESHOLD){
                          rectFrameCount = 0;
                  }
                  CvRect.memcpy(prev, r, r.sizeof());
                  r.y(r.y() + roiFix);
                  final int x = r.x(), y = r.y();
                  cvSetImageROI(grabbed, r);
                  final CvMat mat = grabbed.asCvMat();
  
          List&lt;Integer&gt; frameCoordinates = new Vector&lt;Integer&gt;();
          frameCoordinates.add(r.x());
          frameCoordinates.add(r.x() + r.width());
          frameCoordinates.add(r.y());
          frameCoordinates.add(r.y() + r.height());
          return frameCoordinates;
          double[][] h = getH(mat);
          double[][] l = getL(mat);
          double[][] lmini = Lmini(l);
  
          int[] right = getRight(l, lmini);
          frameCoordinates.add(right[0] + x);
          frameCoordinates.add(right[1] + y);
  
          int[] left = getLeft(l, lmini);
          frameCoordinates.add(left[0] + x);
          frameCoordinates.add(left[1] + y);
  
          int[] upper = getUpper(l, h, right[0], left[0]);
          frameCoordinates.add(upper[0] + x);
          frameCoordinates.add(upper[1] + y);
  
          int[] lower = getLower(l, upper[0]);
          frameCoordinates.add(lower[0] + x);
          frameCoordinates.add(lower[1] + y);
  
                  cvResetImageROI(grabbed);
                  //cvRectangle(grabbed, cvPoint(x, y), cvPoint(x+r.width(), y+r.height()), CvScalar.GREEN, 1, CV_AA, 0);
                  return frameCoordinates;
          }*/
  
          private void init() throws Exception {
                  Loader.load(opencv_objdetect.class);
                  String fileNameFromUrl = Utils.getFileNameFromUrl(Constants.HAAR_CASCADE_MOUTH_FILE);
                  if(!new File(fileNameFromUrl).exists())
                          Utils.get(Constants.HAAR_CASCADE_MOUTH_FILE);
                  classifier = new CvHaarClassifierCascade(cvLoad(Utils.getFileNameFromUrl(fileNameFromUrl)));
                  storage = CvMemStorage.create();
          }
  
          @Override
          public void paintCoordinates(IplImage grabbed,
                          List&lt;Integer&gt; frameCoordinates) {
                  if(frameCoordinates != null){
                          for (int i = 0; i &lt; frameCoordinates.size(); i += 2) {
                                  cvCircle(grabbed,
                                                  new CvPoint(frameCoordinates.get(i),
                                                                  frameCoordinates.get(i + 1)),
                                                                  1, CvScalar.GREEN, 3, 0, 0);
                          }
                  }
          }
  
          protected int[] getLower(double[][] L, int centerLine) {
                  RealMatrix matrixL = new Array2DRowRealMatrix(L);
                  double[] column = matrixL.getColumn(centerLine);
                  for (int i = column.length - 1; i &gt;= 0; i--) {
                          boolean found = true;
                          for (int j = i; j &gt; Math.max(i - lowerConfidence, 0) &amp;&amp; found; j--) {
                                  found &amp;= column[j] &lt; column[j - 1];
                          }
                          if(found)
                                  return new int[] {centerLine, i};
                  }
                  return new int []{centerLine,column.length * 3 / 4};
          }
  
  
          protected int[] getUpper(double[][] L, double[][] h, int right, int left) {
                  RealMatrix matrixL = new Array2DRowRealMatrix(L);
                  RealMatrix matrixH = new Array2DRowRealMatrix(h);
                  RealMatrix hMinusL = matrixH.subtract(matrixL);
                  int centerLine = (int)Math.round((double)(right + left) / 2);
                  double[] column = hMinusL.getColumn(centerLine);
                  // find first getting up
                  boolean found = false;
                  int y = 0;
                  for(int i = 0; i &lt; column.length - 1 &amp;&amp; !found; i++){
                          if(column[i] &lt;= column[i + 1]){
                                  y = i;
                                  found = true;
                                  for (int j = i + 2; j &lt; Math.min(column.length, i + upperConfidence) &amp;&amp; found; j++){
                                          found &amp;= column[i] &lt; column[j];
                                  }
                          }
                  }
                  return new int[]{centerLine, y};
          }
  
  
          /**
           * @param roi a matrix of the roi pixels arranged as BGR
           * @return the Hue matrix
           */
           private double[][] getH(CvMat roi){
                  double[][] h = new double[roi.rows()][roi.cols()];
                  double max = Double.MIN_VALUE;
                  for (int i = 0; i &lt; roi.rows(); i++) {
                          for (int j = 0; j &lt; roi.cols(); j++) {
                                  double R = roi.get(i, j , 2), G = roi.get(i, j , 1);
                                  //h = R / (G + R)
                                                  h[i][j] = R / (G + R);
                                  max = Math.max(max, h[i][j]);
                          }
                  }
                  //scale values to be between 0 - 1
                  for (int i = 0; i &lt; roi.rows(); i++) {
                          for (int j = 0; j &lt; roi.cols(); j++) {
                                  h[i][j] /= max;
                          }
                  }
                  return h;
           }
  
           /**
            * @param roi a matrix of the roi pixels arranged as BGR
            * @return the luminance matrix
            */
           private double[][] getL(CvMat roi){
                   double[][] L = new double[roi.rows()][roi.cols()];
                   double max = Double.MIN_VALUE;
                   for (int i = 0; i &lt; roi.rows(); i++) {
                           for (int j = 0; j &lt; roi.cols(); j++) {
                                   //L = (R + R + B + G + G + G) / 6
                                   double R = roi.get(i, j , 2), G = roi.get(i, j , 1), B = roi.get(i, j , 0);
                                   L[i][j] = (R + R + B + G + G + G) / 6;
                                   max = Math.max(max, L[i][j]);
                           }
                   }
                   //scale values to be between 0 - 1
                   for (int i = 0; i &lt; roi.rows(); i++) {
                           for (int j = 0; j &lt; roi.cols(); j++) {
                                   L[i][j] /= max;
                           }
                   }
                   return L;
           }
  
  
           /**
            * @param L the luminance matrix
            * @return both the Lmini line in 0 index and in [1][0] the mean luminance of Lmini
            */
           private double[][] Lmini(double [][] L){
                   RealMatrix l = new Array2DRowRealMatrix(L);
                   double[][] Lmini = new double[2][L[0].length];
                   for (int i = 0; i &lt; L[0].length; i++) {
                           double[] column = l.getColumn(i);
                           int minIndex = Utils.getMinIndex(column, false);
                           Lmini[0][i] = minIndex;
                           Lmini[1][0] += column[minIndex];
                   }
                   Lmini[1][0] /= L[0].length;
                   return Lmini;
           }
  
           private int[] getRight(double[][] L, double[][] Lmini){
                   final int[] ans = new int[2];
                   final double meanL = Lmini[1][0];
                   for (int i = Lmini[0].length - 1; i &gt;= 0; i--) {
                           if(L[(int)Lmini[0][i]][i] &lt; meanL){
                                   boolean found = true;
                                   for (int j = i; j &gt; Math.max(i - sideConfidence, 0) &amp;&amp; found; j--) {
                                           found &amp;= L[(int)Lmini[0][j]][j] &lt; meanL;
                                   }
                                   if(found)
                                           return new int[] {i, (int)Lmini[0][i]};
                           }
                   }
                   return ans;
           }
  
           private int[] getLeft(double[][] L, double[][] Lmini){
                   final int[] ans = new int[2];
                   final double meanL = Lmini[1][0];
                   for (int i = 0; i &lt; Lmini[0].length; i++) {
                           if(L[(int)Lmini[0][i]][i] &lt; meanL){
                                   boolean found = true;
                                   for (int j = i; j &lt; Math.min(i + sideConfidence, Lmini[0].length) &amp;&amp; found; j++) {
                                           found &amp;= L[(int)Lmini[0][j]][j] &lt; meanL;
                                   }
                                   if(found)
                                           return new int[] {i, (int)Lmini[0][i]};
                           }
                   }
                   return ans;
           }
  
      public void setClassifier(CvHaarClassifierCascade classifier) {
          this.classifier = classifier;
      }
  
      public void setStorage(CvMemStorage storage) {
          this.storage = storage;
      }
  
  
           public void shutdown(){
                   executor.shutdownNow();
                   if(storage != null)
                           storage.release();
           }
  
           public static void main(String ... args) throws Exception{
                   NoMoreStickersFeatureExtractor fe = new NoMoreStickersFeatureExtractor();
                   //fe.setOutput(true);
                   fe.extract( null );
                   fe.shutdown();
       }
  
  }
  </code></pre>
  
  <p>I'm getting the following error when I run it:</p>
  
  <pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
      at main.java.edu.lipreading.vision.NoMoreStickersFeatureExtractor.init(NoMoreStickersFeatureExtractor.java:216)
      at main.java.edu.lipreading.vision.NoMoreStickersFeatureExtractor.getPoints(NoMoreStickersFeatureExtractor.java:70)
      at main.java.edu.lipreading.vision.AbstractFeatureExtractor.getPoints(AbstractFeatureExtractor.java:82)
      at main.java.edu.lipreading.vision.AbstractFeatureExtractor.extract(AbstractFeatureExtractor.java:37)
      at main.java.edu.lipreading.vision.NoMoreStickersFeatureExtractor.main(NoMoreStickersFeatureExtractor.java:389)
  Caused by: java.lang.NullPointerException
      at java.util.Properties$LineReader.readLine(Unknown Source)
      at java.util.Properties.load0(Unknown Source)
      at java.util.Properties.load(Unknown Source)
      at main.java.edu.lipreading.Constants.&lt;clinit&gt;(Constants.java:16)
      ... 5 more
  
  ***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
  
  SETUP: Setting up device 0
  SETUP: 1.3M HD WebCam
  SETUP: Couldn't find preview pin using SmartTee
  SETUP: Capture callback set
  SETUP: Device is setup and ready to capture.
  </code></pre>