Results 1 to 2 of 2
  1. #1
    rahulm87 is offline Member
    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0

    Default Problem in loading Image

    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

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    The photo is probably not in the correct path. Verify this.

Similar Threads

  1. Dynamic image loading in jsp
    By ramakrishna k m in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 10-10-2011, 07:08 AM
  2. Loading image in applet
    By syarizma in forum Advanced Java
    Replies: 0
    Last Post: 08-06-2009, 10:02 AM
  3. Rambling about image loading...
    By Zamppa in forum Java Applets
    Replies: 0
    Last Post: 04-14-2009, 04:55 PM
  4. Need Help!!! Loading Image Into A Jframe
    By lolshooter in forum New To Java
    Replies: 3
    Last Post: 01-06-2009, 08:14 AM
  5. Loading An Image Help Please!
    By shaungoater in forum Java 2D
    Replies: 2
    Last Post: 01-09-2008, 09:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •