title: Why is my BufferedImage receiving a null value from ImageIO.read()
body: <pre><code>BufferedImage = ImageIO.read(getClass().getResourceAsStream("/Images/player.gif"));
  </code></pre>
  
  <p>First of all, yes I did add the image folder to my classpath.</p>
  
  <p>For this I receive the error <code>java.lang.IllegalArgumentException: input == null!</code></p>
  
  <p>I don't understand why the above code doesn't work. From everything I read, I don't see why it wouldn't. I've been told I should be using <code>FileInputStream</code> instead of <code>GetResourceAsStream</code>, but, as I just said, I don't see why. I've read documentation on the methods and various guides and this seems like it would work.</p>
  
  <p>Edit: Okay, trying to clear some things up with regards to what I have in the classpath.</p>
  
  <p>This is a project created in Eclipse. Everything is in the project folder <code>DreamGame</code>, including the "Images" folder. <code>DreamGame</code> is, of course, in the classpath. I know this works because I'm reading a text file in <code>/Images</code> with info on the gif earlier on in the code.</p>
  
  <p>So I have: <code>/DreamGame/Images/player.gif</code></p>
  
  <p>Edit 2: The line that's currently in the original post is all that's being passed; no <code>/DreamGame/Images/player.gif</code>, just <code>/Images/player.gif</code>. This is from a method in the class <code>ImagesLoader</code> which is called when an object from <code>PlayerSprite</code> is created. The main class is <code>DreamGame</code>. I'm running the code right from Eclipse using the <code>Run</code> option with no special parameters</p>
  
  <p>Trying to figure out how to find which class loader is loading the class. Sorry, compared to most people I'm pretty new at this.</p>
  
  <p>Okay, this is what <code>getClassLoader()</code> gets me: <code>sun.misc.Launcher$AppClassLoader@4ba778</code></p>
  
  <p><code>getClass().getResource(getClass().getName() + ".class")</code> returns <code>/home/gixugif/Documents/projects/DreamGame/bin/ImagesLoader.class</code></p>
  
  <p>The image file is being put in <code>bin</code> as well. To double check I deleted the file from <code>bin</code>, cleaned the project, and ran it. Still having the same problem, and the image file is back in <code>bin</code></p>