title: Get path of the image and load it with BufferedImage
body: <p>I don't know why in Java it should be so complicated, but I've already spent a good few hours on this. I have a png image in \src\resources\resize-cursor.png</p>
  
  <p>Now, I want to use this image with <code>BufferedImage</code> class</p>
  
  <pre><code>BufferedImage myPicture = null;
  
  try {
      // this is just one of the examples I tried... I've already tried like 10 ways to achieve this but I am always getting NullReferenceException
      myPicture = ImageIO.read(getClass().getResourceAsStream("\\resources\\resize-cursor.png")));
  } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  </code></pre>
  
  <p>Is there a one working way just to link the png resource in my app?</p>