title: Can't load Properties from JAR
body: <p>For a few days now, I have been trying to get my Java project to load some properties from a file located in it's JAR file. However, I am constantly getting a null pointer when trying to load in the file.</p>
  <p>The folder hierarchy has the properties file in /data, and all the source files in /emp/**/** ...</p>
  <h2>Code</h2>
  <pre><code>Properties defaultProps = new Properties();
      try {
          InputStream in = getClass().getClassLoader().getResourceAsStream(&quot;data/build_info.properties&quot;);
          //InputStream in = new URL(&quot;file:data/build_info.properties&quot;).openStream();
  
          defaultProps.load(in);
          in.close();
      } catch (FileNotFoundException e) {
          //e.printStackTrace();
      } catch (IOException e) {
          //e.printStackTrace();
      } catch (NullPointerException e){
          Log.E(&quot;NPE- Properties not loaded&quot;, &quot;properties&quot;);
          revision = &quot;Properties file not found&quot;;
      }
  
      if (defaultProps.getProperty(&quot;build.major.number&quot;) == null) {
          Log.W(&quot;Properties not loaded&quot;, &quot;properties&quot;);
          revision = &quot;Properties file not found&quot;;
      } else {
          Log.V(&quot;Properties Loaded Successfully&quot;, &quot;properties&quot;);
          
          revision = &quot;Version: &quot; + defaultProps.getProperty(&quot;build.major.number&quot;)
              + &quot;.&quot; + defaultProps.getProperty(&quot;build.minor.number&quot;) + &quot;    &quot;
              + &quot;Revision: &quot;
              + defaultProps.getProperty(&quot;build.revision.number&quot;);
      }
  </code></pre>