Skip to main content

Problem in loading Image

No replies
rahulm87
Offline
Joined: 2009-08-19
Points: 0

hi friends i done the following code

File file = new File("2.jpg");
BufferedImage photo=null;
photo=ImageIO.read(file);
System.out.println("Width:"+photo.getWidth());

but the image is not loading and getting a nullpointer exception at the last line

friends please help