How to access files in the resources directories from scala source using sbt layout
<p>I am having issues using sbt and scala accessing files in different directories from scala code. I have the typical sbt directory layout shown below.</p>

<pre><code>main
 |- build.sbt
 |- project/
 |- src/
     |- main/
         |- scala/
         |- resources/
               |- board
     |- test/
         |- scala/
 |- target/
     |- scala-2-11/
         |- classes
              |- board/
              |- com/
                  |- tgm
                      |- frpoject
</code></pre>

<p>Now in my code in the src/main/scala directory I have code that needs to access images in the resources/board directory. So executing it from the sbt console I thought it would be running from the classes directory under target so in my code I added it as so.</p>

<pre><code>val white_b = "../../../board/ew.gif"
</code></pre>

<p>that didn't work so then I tried it from the source directory as so.</p>

<pre><code>val white_b = "../resources/board/ew.gif"
</code></pre>

<p>I am trying to load the image with</p>

<pre><code>val wb  = ImageIO.read(new File(this.white_b))
</code></pre>

<p>I keep getting the error</p>

<pre><code>[error] (run-main-10) javax.imageio.IIOException: Can't read input file!
javax.imageio.IIOException: Can't read input file!
   at javax.imageio.ImageIO.read(ImageIO.java:1301)
</code></pre>

<p>Any help to what I am missing is appreciated. Thanks! :\</p>

<p><strong>EDIT:</strong></p>

<p>Apparently you have to access it this way if using sbt console</p>

<pre><code>val white_b = "target/scala-2.11/classes/board/ew.gif"
</code></pre>

<p>So will this mess up the code once a jar is created, am I using resources wrong?</p>