title: How do I go about adding an image into a java project with eclipse?
body: <p>I've done a lot of reading around SO and Google links.</p>
  
  <p>I have yet to figure out how to correctly add an image into an eclipse gui project is such a way that the system will recognize find it. I know there's some mumbojumbo about CLASSPATH but it probably shouldn't be this difficult to do.</p>
  
  <p>Let me start by describing what I'm doing...(If someone could correct me, it'd be appreciated.)</p>
  
  <p>Here is my method. </p>
  
  <p>I add the image using the "import wizard" (right click, "import", "general", "file") into an "import directory" I called "/resources"</p>
  
  <p>Eclipse automatically creates a folder called "resources" in the eclipse package explorer's tree view. Right under the entry for "Referenced Libraries".</p>
  
  <p>Note, "resources" isn't under "Referenced Libraries", it's at the same level in the tree.</p>
  
  <p>I then use the following code:</p>
  
  <pre><code>ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
  InputStream input = classLoader.getResourceAsStream("/resources/image.jpg");
  Image logo = ImageIO.read(input);
  </code></pre>
  
  <p>And at this point, I run the test program and get this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: input == null!
      at javax.imageio.ImageIO.read(Unknown Source)
      at Test.main(Test.java:17)
  </code></pre>
  
  <p>Thanks for any help in advance!</p>