title: How can I include resource files when I make a jar?
body: <p>I've made a game that uses images from another file. I asked this question: <a href="https://stackoverflow.com/questions/37768331/how-can-i-get-a-program-that-uses-external-files-into-a-jar">How can I get a program that uses external files into a JAR?</a> which was marked as duplicate. The other question seemed to only deal with text files, and didn't help at all. I did a bit more research, and I think I need to put the project and the image files into one jar. I looked at this question: <a href="https://stackoverflow.com/questions/13944574/how-can-i-include-my-icon-when-i-export-my-project-to-a-jar-file">How can I include my icon when I export my project to a jar file</a>, but I couldn't understand how to do it by reading the answer. I would have commented to ask for more clarity, but I need 50 reputation, which I don't have yet. I just need my program to be able to use image files when it is in jar form. It seems strange that things that work in an IDE don't always work in a jar. :P</p>
  
  <p>This is the method I'm using to get the image files:</p>
  
  <pre><code>private Image retrieveImage(String filePath)
  {
      try{
          Image image = (Image)ImageIO.read(new File(filePath));
          return image;
      } catch(Exception exc)
      {
          System.out.println(exc.toString());
          return null;
      }
  }
  </code></pre>
  
  <p>The exception I get is: javax.imageio.IIOException: Can't read input file!</p>
  
  <p>Thanks for all your help :)</p>