title: reading a text file from within a Jar on a remote device
body: <p>Having researched this issue extensively here &amp; elsewhere, without finding a <em>working</em> solution, I thought I'd ask...</p>
  <p>I have a jar file (deployed on a RaspberryPi), with an internal structure like this:</p>
  <ul>
  <li>myApp
  <ul>
  <li>MyClass</li>
  <li>....</li>
  </ul>
  </li>
  <li>textFiles
  <ul>
  <li>foo.txt</li>
  <li>....</li>
  </ul>
  </li>
  </ul>
  <p>I need 'MyClass' to read 'foo.txt'.</p>
  <p>the general advice here &amp; elsewhere is to use something like the following:</p>
  <pre><code>InputStream in = getClass().getResourceAsStream(&quot;../textFiles/foo.txt&quot;); 
  BufferedReader reader = new BufferedReader(new InputStreamReader(in));
  </code></pre>
  <p>I have also read that the path to use (as the param for <em>getResourceAsStream()</em>) is  the path to the target file, <em>relative</em> to the location of the class reading the file.(..?)</p>
  <p>However, regardless of the path I use, I cannot get the above 2 lines to work. I always get an NPE thrown by the 2nd line.</p>
  <p>I'm assuming that the NPE indicates that 'in' is null because 'foo.txt' has not been found.</p>
  <p>any advice leading to a successful resolution, gratefully received.</p>
  <p>cheers</p>
  <p>Paul</p>