title: How to get the image from project classpath in Servlet on Netbeans
body: <p>I made a <code>/header</code> folder in the web pages directory in Netbeans and added an image named <code>header.png</code>. Now I want to access this image file in a servlet using the following code:</p>
  
  <pre><code>BufferedImage image = ImageIO.read(getClass().getResource(" /header/header.png"));
  </code></pre>
  
  <p>But this is not happening, it gives the following error:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: input == null!</p>
  </blockquote>
  
  <p>Below is my project's directory structure:</p>
  
  <p><img src="https://i.stack.imgur.com/gSMui.png" alt="enter image description here"></p>
  
  <p>How is this error caused and how can I solve it?</p>