title: Cannot load resource in jar
body: <p>I am trying to load a resource in a jar, here is the exported jar:
  <a href="https://i.stack.imgur.com/r6m3q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r6m3q.png" alt="enter image description here"></a></p>
  
  <p>'main' is the package with all my classes, and in one of those classes I am trying to load the background.png file. In my Eclipse project I put the resources under a "res/" folder, which I added to the build path to include it. When I try to use</p>
  
  <pre>new File("background.png");</pre>
  
  <p>It can't find the file.
  When I use</p>
  
  <pre>MyClass.class.getClass().getClassLoader().getResource("background.png");</pre>
  
  <p>It still can't find the file.</p>