Problem loading images - please help

Hi,
I have a slight problem loading images. I'm using netbeans 5.0 and have a few packages setup in a project called Maths. In a package called LineConnection theres a class that needs to read an image and display it on screen. To load the image I use:
URL url = getClass().getResource("fraction/pic1.png");
Image img1 = Toolkit.getDefaultToolkit().getImage(url);This loads the image and I can display it on screen fine.
The problem is that the folder fractions with the images in HAS to be located within the Maths/build/class/LineConnection folder otherwise it wont load the image and I get a null pointer exception.
I want to be able to have the folder containing the images in folder Maths so that it's one folder above the src folder. But if I put it here (or anywhere else) the images can't be found and loaded.
Could someone tell me why the images can only be found if they're within the build folder because it's causing me some problems when I try to create an executable JAR.
Cheers

I've used:
URL url = ImageHandler.class.getResource("fractions/q0.png");               
System.out.println("URL = " + url);to determine whether the file is found.
If I put the file in the folder build/classes/LineConection/fractions/q0.png then it finds the image and prints the file path.
But, if I put it in another folder such as the src folder it can't find the image and url = null;
How can I make netbeans search in other folders for the resources so I can store them where I like?

Similar Messages

  • Problems opening images - please help!

    I just transferred 350 photos from my camera to my Mac, and the last 179 items I cannot open.
    I receive the error message 'Item "Namehere.JPG" is used by Mac OS X and cannot be opened.' These images are also listed as having 0Kb on the disk.
    I have found this problem elsewhere on the discussion boards, but it has yet to be solved - does anyone have any ideas?!
    These images are very important to me, as they are from a recent trip and my cousin's wedding
    Thanks.

    I have actually been looking on google for a while trying to figure out how to perminately kill programs when they open, and take them off. it would be a huge help if anyone knows how.

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • TS1702 My millionaire and friends game won't load onto my iPad or iPhone 5? It was working in the beginning but now it won't even load. I have restarted my device & deleted and reinstalled the app several times and it still won't load? Please help

    Millionaire and friends game not loading! Please help! I have tried restarting the device & deleting the app and trying to reload but nothing works? I also tried to email the creators of the app but the email address for tech support bounced back to me so its obviously not a good email??

    I tried to email the developer (Canada) but the email for technical support is not a good email. My email got returned to me undeliverable? Not sure what to do next? I also want to get the game going again cause I made purchases to get more coins to play the game & now I can't even use it? Very frustrating!!!

  • HT201263 my ipad give me the apple sign without running up it appears all the time in the screen , i tries to reset my ipad , but still in this problem , can you please help me?

    my ipad give me the apple sign without running up it appears all the time in the screen , i tries to reset my ipad , but still in this problem , can you please help me?

    You may want to look at this about using recovery mode to restore your iPad.
    http://support.apple.com/kb/ht4097

  • My mac starts up in a white screen with a loading bar and a loading circle please help

    My mac starts up in a white screen with a loading bar and a loading circle please help

    I do hope you have recent backup, because it look like your hard disk is failing. You can start up in Recovery Mode, and run Disk Utility to see if the disk can be fixed:  OS X: About OS X Recovery - Apple Support

  • IOException: Problem loading image

    Hi foreros
    What could be the reason behind an error like this IOException: Problem loading image except it cannot find the jar path for the images?
    Regards
    Tizha

    Without more information, I'd say there's not enough available RAM to load the image.

  • It won't let me drag an effect from the browser all of a sudden. I have always been able to do before. I am using effects from favorites bin and when I try to drag it, it won't move. I have never had this problem before. Please help.

    It won't let me drag an effect from the browser all of a sudden. I have always been able to do before. I am using effects from favorites bin and when I try to drag it to the timeline, it won't move. I have never had this problem before. Please help.
    P.S. I have tried other effects including transitions and it still won't let me drag.

    Wow that was really quick, thank you so much.  Im not sure at all which version it was because i said it was around 4 years ago he bought it.  I know it isn't under his username, since he's a PC person (ugh) so i know its probably registered to one of our actual names.  isn't there some way to look it up since we did register it, because I'm not even sure where the disks are from when we bought it (we've moved a lot and also have two storage lockers, i know i would have kept it with other disks) but my cd rom drive is actually broken on my computer as well ( i think it got stepped on and is now squished and won't eject or run disks.)
    So is there anyway they can look up that its registered to one of our names since we did register it when we bought and installed it, or do i really have to find the disk with some sort of proof of purchase (i know there would be no receipt after all this time)
    either way, ill do what you suggested to the best of my abilities and thank you so much for answering my questions, i can't even open the program as its incompatible and find out the info from that) so I'm in a bit of a pickle and your response was so thorough and it didn't seem to be posted long enough to even write a well researched response, thanks, all the best,
    sarucia

  • Mac Book Air sleeps when moved...i don't know whats the problem...please help me out if anyone knows about this...

    Mac Book Air sleeps when moved...i don't know whats the problem...please help me out if anyone knows about this...

    your reed switch for the monitor is defective, it thinks youve shut the lid when you havent
    mechanical fault , contact Apple for service and parts replacement.

  • I want to ask how to downgrade ios 7 to 6.1.3, because a lot of problems ios 7. please help

    I want to ask how to downgrade ios 6.1.3 to 7, because a lot of problems ios 7. please help

    I'm sorry, but Apple does not provide a downgrade path for iOS. Because downgrading is unsupported by Apple we cannot discuss it on these forums.

  • Error getting license. License server communication problem: E_ADEPT_NO_TOKEN. Please help

    I try to download my ebooks on my laptop but receive the onscreen message, Error getting license, License server commucication problem: E_ADEPT_NO_TOKEN. Please help?

    It means, the URLLink.ACSM file is corrupted. Please contact the book store and ask them to check whether the configuration in the server side is correct for that book.
    One of the simple setting in the server which can case this issue is, setting the book for loan in server and providing the purchase option in the book store or vise verse.
    Hope this solves your problem.

  • TS1702 Samurai seige not loading. Please help.

    Samurai seige froze up when purchasing gems. Will not boot. Deleted it reloaded. Still won't load. Please help.

    You need to inform the JVM of the location of your classes, i.e. test.jar or whatever the jars name is.
    For Example
    if my applet.html is located in testFolder/html/
    And my applet.jar is located in testFolder/jars/
    Then, the following is my object tag
    <object height="0" width="0" code="com/myClasses/test" codebase='../' archive='jars/applet.jar'></object>

  • When I'm in school, the pages in Safari won't load. Please help?

    When I'm in school, the pages in Safari won't load. Please help?

    When I'm in school, the pages in Safari won't load. Please help?

  • HT1386 i tried to sync my ipad to my itunes using usb but it will say not charging,, i can sync with my ipod touch without any problem... please help..

    i tried to sync my ipad to my itunes using usb but it will say not charging,, i can sync with my ipod touch without any problem... please help..

    From http://support.apple.com/kb/HT4060 :
    The fastest way to charge your iPad is with the included 10W USB Power Adapter. iPad will also charge, although more slowly, when attached to a computer with a high-power USB port (many recent Mac computers) or with an iPhone Power Adapter. When attached to a computer via a standard USB port (most PCs or older Mac computers) iPad will charge, but only when it's in sleep mode.
    iPods need less power to charge them (their wall charger is half the power of the iPad's, 5W as opposed to 10W), so are more likely to charge via USB

  • How to Load External Images - Please Help!

    I have created a simple portfolio site. The buttons I created
    trigger separate frames. Could I not create a MC (Movie Clip) on
    each frame where the images now reside and then when the button is
    clicked (On "Click' Goto frame 1) for e.g. then the image would be
    loaded from an external folder named "Images" in my website?
    I am stumped as to how to set this up. Could someone please
    help me?
    Thanks

    Yes, you can do that. Which version of Flash and which
    version of Actionscript are you using?

Maybe you are looking for

  • Firefox 5 on my Windows 7 64 bit laptop locks up. Have not be able to get on the internet for days.

    I have used Firefox for 3 years on all my computers. However, Firefox 5 on my Windows 7 64-bit laptop locks up. I want to uninstall it and use an earlier version. Also, the "key' in the address bar to 'remember the password' for this site will NOT be

  • TABLESPACE cleanup not happening after table data delete

    Hi all I have a partitioned table with 4 partitions all residing in a single tablespace. I populated the table with sample data and then deleted all with a simple delete statement followed by a commit. But the tablespace is still showing data from th

  • How to resolve Extended Systax check  Error..

    Hi All, In Syntax check i am not getting any errors,If  i have check Extended Syntax check I have got 2 error in SLIN ( Extended Syntax Check) Like ERRORS     : #Messages for MESSAGE(Error)       Program:  ZMXXR600A  Row:    416 No. of WITH fields of

  • URL required in Profile Wizard when launching trial version of UPK 11.1

    I downloaded a trial version of UPK 11.1 Developer (client) to analyze for my organization for use in content development. When attempting to launch the trial software for the first time, I'm taken to a Profile Wizard which says "Type the URL of the

  • Click-n-ship

    The new Safari comes with inline pdf viewing. Nice, except it does not work with the US Postal Service click-n-ship service. When the USPS site sends the PDF to the browser, safari does not show it inline or give you the option to save it. The work a