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 2D Example compile error

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java 2D Example compile error

    Hi. I am having trouble running sample java code for a 2D example. It seems to compile okay, but it does not run. I made sure to change the ".png" image file and place it in the source folder, but that did not help. I can't pin point the error and how to fix it. Any help with this would be appreciated. Thanks in advance. Here is the output of the error I get when I try to run it.

    C:\Users\Drew\workspace\AdvancedJava\Tester\ImageP anel_4_6>javac -d . *.java

    C:\Users\Drew\workspace\AdvancedJava\Tester\ImageP anel_4_6>java com.chptr4.imagepanel.Java2DExample
    Uncaught error fetching image:
    java.lang.NullPointerException
    at sun.awt.image.URLImageSource.getConnection(Unknown Source)
    at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
    at sun.awt.image.InputStreamImageSource.doFetch(Unkno wn Source)
    at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
    at sun.awt.image.ImageFetcher.run(Unknown Source)
    Attached Files Attached Files
    Last edited by weziw; April 2nd, 2012 at 01:01 AM. Reason: Remove duplicate text


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Java 2D Example compile error

    If you want help, you'll have to post an SSCCE that demonstrates only that problem. Nobody wants to download a .rar file- make it easy for people to help you.

    I suggest you create a File instance with the image path you're using, then print out the absolute path of that File. Is that what you expected?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Code won't compile, but can't find the error....
    By RockDoc in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 29th, 2012, 02:09 AM
  2. Error while compile
    By when im gone in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 7th, 2012, 10:53 AM
  3. [Compile Error] Whats wrong with that ?
    By Anomis in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 5th, 2011, 11:01 AM
  4. Compile Error, tried everything please help
    By cdub0 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 17th, 2011, 03:31 AM
  5. What's wrong. Compile Ok but error when execute.
    By hantuapi in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 1st, 2011, 05:33 AM