title: how to package and reference text file in resources folder
body: <p>I have a spark project using scala and sbt. At one point it references a text file which I want to be packaged.
  This is how it is referenced in the application source:</p>
  
  <pre><code>getClass.getResource("/myFile.txt")
  </code></pre>
  
  <p>This works fine running the source code with sbt run. But I want it to be packaged and deployed to a server.</p>
  
  <p>In build.sbt, after some googling I have got this to work</p>
  
  <pre><code>import NativePackagerHelper._
  mappings in Universal ++= directory("src/main/resources")
  </code></pre>
  
  <p>adding this meant that the myFile.txt appears in the resources folder in the package. created using </p>
  
  <blockquote>
    <p>sbt universal:packageBin</p>
  </blockquote>
  
  <p>resulting folder structure:</p>
  
  <pre><code>target - universal - bin
                     - lib
                     - resources
  </code></pre>
  
  <p>however when I run my packaged application from bin/my-application.bat , I get the following error</p>
  
  <blockquote>
    <p>Exception in thread "main" org.apache.spark.sql.AnalysisException: Path does not exist: file:/C:/Software/my-application-0.0.1/lib/my-application-0.0.1.jar!/myFile.txt;</p>
  </blockquote>
  
  <p>Bear in mind I have zero experience of deploying scala or jvm based things so you may have to spoonfeed me the explanation</p>
  
  <hr>
  
  <p>EDIT I later realised that the text file was in fact included in the .jar file.
  the issue then was that getResource does not work in this case and I had to adapt my code to use getResourceAsStream</p>