title: Java - Load image from source
body: <p>I've seen this answer: <a href="https://stackoverflow.com/questions/1096398/add-image-to-jar-java">Add image to JAR Java</a>
  But I didn't understand how does it work. I'll try to explain step-by-step.</p>
  
  <p><b>At the begining I add image to my project</b></p>
  
  <ul>
  <li>test
  
  <ul>
  <li>src
  
  <ul>
  <li>com.test
  
  <ul>
  <li>tester.java</li>
  <li>img.png</li>
  </ul></li>
  </ul></li>
  <li>images
  
  <ul>
  <li>img.png</li>
  </ul></li>
  <li>JRE System Library</li>
  </ul></li>
  </ul>
  
  <p>My question - where should I place my img.png?</p>
  
  <p><b>Then I try to get it from resource</b></p>
  
  <pre><code>URL url = tester.class.getResource(PATH);
       ImageIcon ii = new ImageIcon(url); 
  </code></pre>
  
  <p>I've tried different pathes like bellow:</p>
  
  <ul>
  <li>"images/img.png" - it doesn't work. ii has wrong size and etc</li>
  <li>"/images/img.png" - it doesn't work at all.</li>
  </ul>
  
  <p>Could you tell me what I'm doing wrong?
  if it isn't difficult for you, please step-by-step.</p>
  
  <hr>
  
  <p><b>
  Guys, I've taken note that if I have an url with large length, I can't see images, but if I copy file onto C:(for example), I can see it. What's happened? Is it bug? By the way, my url contains !!! symbols. </b></p>