Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java Image Problem! Probably easy fix!

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Java Image Problem! Probably easy fix!

    Hello, I am currently getting
    "Uncaught error fetching image:
    java.lang.NullPointerException
    at sun.awt.image.URLImageSource.getConnection(URLImag eSource.java:99)
    at sun.awt.image.URLImageSource.getDecoder(URLImageSo urce.java:113)
    at sun.awt.image.InputStreamImageSource.doFetch(Input StreamImageSource.java:240)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher. java:172)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:1 36)
    "
    even though every image is in the proper folder. I have multiple images and for some reason only 1 set wont load. Heres the code:
    rammusImage = Toolkit.getDefaultToolkit().getImage(getClass().ge tResource("rr"+animationValue+".png"));
    g.drawImage(rammusImage, width/3, height/2, null);


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,646
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: Java Image Problem! Probably easy fix!

    For debugging purposes add a println that prints out the path to the image before using it to get the image. Look at the print outs and make sure that the path is correct.

Similar Threads

  1. Array code problem Please help fairly easy
    By LOPEZR in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 28th, 2011, 10:51 AM
  2. Little easy to fix problem
    By adammint7 in forum Java Theory & Questions
    Replies: 9
    Last Post: April 14th, 2011, 10:07 AM
  3. Quick easy Java question.
    By DHG in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 25th, 2011, 02:59 PM
  4. Java Gif image problem in JFrame
    By Zachary Wins in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 23rd, 2010, 08:51 PM
  5. JAVA Image Icon and JButton resizing problem
    By antitru5t in forum AWT / Java Swing
    Replies: 1
    Last Post: March 13th, 2009, 04:39 AM

Tags for this Thread