title: JavaFX nullPointer on javaFX Image
body: <p>I have a part of my project of a 2k12 Dice, which should give you a result, based on the random int generator, and should set an Image (javaFX Image class) on a Label with an animal.</p>
  
  <p>The following:</p>
  
  <pre><code>public enum Animals {
  
  
  RABBIT("rabIco.png"), SHEEP("sheepIco.png"), PIG("pigIco.png"), COW("cowIco.png"), HORSE("horIco.png"), WOLF("wolIco.png"), FOX("foxIco.png"), SMALL_DOG("sdoIco.png"), BIG_DOG("bdoIco.png");
  
  
  private Image image;
  
  Animals(String imgSrc) {
      image = new Image(Main.class.getClassLoader().getResourceAsStream(imgSrc));
  }
  </code></pre>
  
  <p>The constructor, when initiated by a click, gives me this:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException: Input stream must not be null
  at javafx.scene.image.Image.validateInputStream(Image.java:1128)
  at javafx.scene.image.Image.&lt;init&gt;(Image.java:706)
  at sample.Animals.&lt;init&gt;(Animals.java:14)
  at sample.Animals.&lt;clinit&gt;(Animals.java:8)
  </code></pre>
  
  <p>The icons are in a res folder marked as a default resource folder.
  I copied the icons everywhere, to res, to sample folder, everywhere. Its like a disease spreaded e v e r y w h e r e , and nothing.</p>
  
  <p>NullPointerException.
  Image will notload. The button has an Icon loaded via ImageView but that is a workaround and It's not happening on the labels as this is an ImageView.</p>