title: Eclipse - referencing Java resources
body: <p>This is probably just the IDE specifics.  But with Eclipse, I'm interested in organizing my classes and resources a little more-so. </p>
  
  <p>As I understand it, the defaulted "src" directory is the place to throw all my resources.
  And if my resources reside in there I can reference them like this:</p>
  
  <pre><code>ImageIcon icon = new ImageIcon("src/icon-16x16.png");
  </code></pre>
  
  <p>If I create a directory just for icons (inside the src/ directory), then I simply change the path as such:</p>
  
  <pre><code>ImageIcon icon = new ImageIcon("src/icons/icon-16x16.png");
  </code></pre>
  
  <p>So, now I want to do a separate directory for my resources outside the src/ directory.</p>
  
  <p>Here's my old structure:</p>
  
  <pre><code>prj.HelloWorld  (project)
  -&gt; src/ .........
  -&gt; src/images/ ........
  -&gt; src/ (default package) ......classes.java
  </code></pre>
  
  <p>Here's what I've cleaned up:</p>
  
  <pre><code>prj.HelloWorld  (project)
  -&gt; classes/ .........
  -&gt; images/ ........
  -&gt; media / ........
  </code></pre>
  
  <p>Now, I'm interested in using a dedicated Project (<strong>prj.Resources</strong>), just for my common resources I can share in all projects.</p>
  
  <pre><code>prj.Resources  (project)
  -&gt; global_classes/ .........
  -&gt; global_images/ ........
  -&gt; global_media / ........
  
  prj.HelloWorld  (project)
  -&gt; classes/ .........
  -&gt; images/ ........
  -&gt; media / ........
  </code></pre>
  
  <p>And then modify <strong>prj.HelloWorld</strong> by adding <strong>prj.Resources</strong> to the Projects Tab inside the Java Build Path.</p>
  
  <p>(prj.HelloWorld > Properties > Java Build Path > Projects Tab > Add...) </p>
  
  <p>I've done that so far, and any classes inside the <strong>prj.Resources/global_classes/</strong> are successfully being detected.</p>
  
  <p>But images inside global_images are not.</p>
  
  <pre><code>ImageIcon icon0 = new ImageIcon("global_images/icon.png");
  </code></pre>
  
  <p>I know we can use resources located in different projects, but I'm missing something obvious here.   </p>