1

Possible Duplicate:
How to get the image from project classpath in Servlet on Netbeans

I have written following codes in servlet file to read image which is saved in "header" folder of my projects classpath.

BufferedImage image = ImageIO.read(getClass().getResource("/header/header.png"));

But it is giving following error..

java.lang.IllegalArgumentException: input == null!

Here is my projects directory structure..

enter image description here

Plz guys help me in solving this error.Thanx in advance.

Community
  • 1
  • 1
Amit
  • 233
  • 1
  • 5
  • 9
  • where do u have your image, tell the path? – sunleo Nov 30 '12 at 07:16
  • @sunleo Sir i am using netbeans ide and image is in the "header" folder of "web pages" directory. – Amit Nov 30 '12 at 07:19
  • i did but same error Sir – Amit Nov 30 '12 at 07:29
  • You may want to have a look at this : http://stackoverflow.com/a/9866659/174184 and this : http://stackoverflow.com/questions/9582261/adding-background-in-jbutton-netbeans-gui-builder/9583367#9583367 – TJ- Nov 30 '12 at 08:29
  • i changed with " BufferedImage image = ImageIO.read(getClass().getResource("/header/header.png"));" but still same error and i am doing it in servlet page of my project – Amit Nov 30 '12 at 08:34

0 Answers0