Cannot load image to an Applet

I cannot use ImageIcon( "mylogo.jpg")
because I've got this security error in the java console:
ava.security.AccessControlException: access denied (java.io.FilePermission mylogo.jpg read)
whay should I do ?
how come there is no such problem with the audio clip that I load ?

1. but I don't use URL in audio clipIf you use Applet.getAudoClip(), you do, because that's what the method requires.
2. I get null exception when I use your suggestionthen change the path so that it correctly points to the file.

Similar Messages

  • Using Firefox to access facebook chat Button or online friiend chat button generates a Black screen with CANNOT LOAD IMAGES and no chat window opens.

    This does not happen in other browsers and it happens on a variety of computers I have access to and would seem to be a common problem but I can find no identical cases in my searches of
    Firefox , Facebook or windows help or Google search. My home machine is only a P2 with WINXPCORP but works fine and I have done all updates but still have this continuing problem every time I try to use Firefox
    to access Facebook chat but it does not happen with IE or chrome
    The response to clicking on chat button or friend chat is a black screen with small center square box with blue title bar that says
    '' VIEW IMAGE FULL SCREEN - (42) FACEBOOK X""
    center of box is ""! "" mark in yellow triangle and wording
    "" CANNOT LOAD IMAGES ''' OK
    clicking on OK returns to facebook page but no chat opens.
    Some times |VERY RARLEY if as the page loades you click on
    chat button with 1/2 second of it appearing chat will open.

    Hi,
    Please also see [https://support.mozilla.org/en-US/kb/Problems%20using%20Facebook%20in%20Firefox this.]

  • Problem loading images in my applet

    Hi guys,
    When i test my Applet using an IDE the images are loaded fine, however when I run my applet using a browser it wont load the images.
    I think it is because I use this line:
    System.getProperty("java.class.path",".")My question is, how do you load images into an applet without signing it.
    Any help would be great.
    Alex

    Axilliary files like images, properties files etc. which are essentially part of the program are refered to as "resources". The best way to access these files is by the getResource() methods in the Class or ClassLoader objects. If you do it that way then the JVM reads them exactly the same way it reads .class and from the same place.
    Say your using an image, say my.gif from a class called MyClass. You put the image file in the same directory as the MyClass.class file. Then, in MyClass, you do:
    static ImageIcon myImage = new ImageIcon(MyClass.class.getResource("my.gif"), "MY Image");That will pick up the image from a file, from an http connection, from a jar, of from any combination of same.

  • Cannot load image

    Hi,
      I'm trying to add the logo to the marketing document's PLD. Added the image sucessfully in the server. When trying to load the image in the client, nothing happens. Tried to add the image under the option print preference. got the error message as "cannot load image". Please forward your solutions to fix the issue.
    Thanks & Regards
    Murugappan.T

    Hi Dear,
    You can add image on the PLD as follows.
    1) Add one Picture Field on the Report
    2) Paste the Image file into the Bitmap Folder on the server
    3) Click on Content-->then Browse.then select that image file from server
    4) then after that you can set the properties from Format tab.
    You need not set the Image file from the every client machine,
    PLD setting were loaded into the database.i.e.PLD is Database specific not user specific.
    Hope this will help you...
    lg Mahendra

  • Cannot load images anymore in incoming mail in V29

    I cannot get images to load in incoming mail since installing V29, nor do I get the option to allow it to do so above the email

    I'm having the same problem. No embedded images display (attached images do display) and no notice above the email to allow images either temporarily or permanently. V 24.5

  • Loading Images for web Applet

    I just recently learned how to load a applet to my site, and now that I'm able to load simple ones up I want to move on. I made a game this morning, but I used images in it. When i loaded the applet to the site, it didn't work. As suggested from another user I tried:
    Image background=this.getImage(getCodeBase(),"/forest.gif"); All of the applet's classes/html file is in the root directory folder with all of my images. I also tried...
    Image background=this.getImage("http://www.StevePicHolder.1colony.com/images/forest.jpg");and no luck...What do I need to do to make my applets online be able to use pictures?

    The Applet.getCodeBase() method returns the absolute URL where your class files reside. If the image file is in the same location you would code the following:
    Image background=this.getImage(getCodeBase(),"forest.gif");If your image file is in a path relative to the code base (e.g., an images folder residing relative to your class files) then specify the relative path via the following:
    Image background=this.getImage(getCodeBase(),"images/forest.gif");If your image files are in the same or relative location of your HTML file containing the APPLET tag then use the getDocumentBase() method instead.

  • Cannot load images from URL, but ok from file?

    Hi people,
    In the followint simple code (I'm eventually placing these into a media tracker), when I'm debugging on my local PC, the images load no problem, but when I deploy to the web they do not. The rest of the application carries on regardless however. I'm wondering if this is a sufficiently generic method of getting media resources. http://www.thermoteknix.com/93266898/VirtualVisIR_Main.htm (its a simulation of one of our new infrared cameras). I cannot get it to load media, unless its from my hard-drive of course!
    Does anyone know what I should do instead?
    URL Url = Parent.getDocumentBase ();
    VisIRBackground     = Parent.getImage ( Base, "images/rear view.jpg" );
    VisIRThermoIcon     = Parent.getImage ( Base, "images/redonion.gif" );
    VisIRIndigoIcon     = Parent.getImage ( Base, "images/indigo.gif" );
              

    Ok, just in case is isn't anything to do with paths, here is my loop to load all of my images (which have been created with getImage (x,y)):
    Is this technically correct? I've added the images to the media tracker with an incrementing ID, so we have 1 ID per item, starting at zero.
    for ( nImagesLoaded = 0; nImagesLoaded < nImagesToLoad; nImagesLoaded++ )
         try {
              VisIRMediaTracker.waitForID ( nImagesLoaded );
              bFailed = VisIRMediaTracker.isErrorID ( nImagesLoaded );
              if ( bFailed )
                   break;
         catch ( InterruptedException e ) {
              System.err.println( e.toString () + new Integer ( nImagesLoaded ).toString () );
    }

  • Problem loading image in an applet

    I've written the simplest of Java applets that loads a single image (a map) for a conservation website. However, I've determined that, depending on the filename (it appears), the map is either visible or not. I was after some help to debug this - I really don't understand why the filename "Peacock.gif" works but "Glanville Fritillary.gif" doesn't. Other filenames with spaces in the name are fine, so I don't think this is a factor. The map itself is fine since I can simply change the name and it works fine! I'm using JRE 1.6.0_03 - and am wondering if there's a caching bug that's been introduced since this all used to work fine, I believe. Help!
    Code below.
    HTML
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
         </head>
         <body>
              <applet width="515" height="744" code="bsiteAppletDistribution2.class">
         </body>
    </html>
    Applet code
    import java.applet.Applet;
    import java.awt.*;
    public class bsiteAppletDistribution2 extends Applet
         private static final long serialVersionUID = 1L;
         Image map;
         public void init()
              map = this.getImage(this.getDocumentBase(), "Peacock.gif");
         public void destroy()
              map.flush();
         public void update(Graphics g)
              paint(g);
         public void paint(Graphics g)
              g.drawImage(map, 0, 0, this);
    }

    Hmmm. I've rolled back to version 1.5 of the JRE and everything works fine. Seems like it's a bug in the caching implementation of version 1.6 but can't be sure.
    Any ideas? And thanks in advance!
    - Pete

  • I cannot load my java card applet Response APDU: 69 85

    I know there have been many threads on this subject, I am a newbie to Java card development.
    Please someone help me.
    I am using the gpj for downloading the applet.
    The following is the output from the command "java -jar gpj.jar -load JCHelloWorld.cap -install"
    Thanks in advance
    run:
    Found terminals: [PC/SC terminal Generic PCSC Smartcard Reader 0]
    Found card in terminal: Generic PCSC Smartcard Reader 0
    ATR: 3B DB 96 00 80 B1 FE 45 1F 83 00 31 C0 64 C7 FC 10 00 01 90 00 74
    INFO: Selecting Security Domain OP201a, AID=A000000003000000
    DEBUG: Command APDU: 00 A4 04 00 08 A0 00 00 00 03 00 00 00
    DEBUG: Response APDU: 6F 6E 84 08 A0 00 00 00 03 00 00 00 A5 62 73 2F 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 01 05 9F 6E 2A 48 20 50 2B 82 31 80 30 00 63 03 12 63 00 07 BB 03 00 11 42 12 97 11 43 12 97 11 44 12 97 01 00 00 00 00 00 00 00 00 00 00 00 9F 65 01 FF 90 00
    Successfully selected Security Domain OP201a A0 00 00 00 03 00 00 00
    DEBUG: Command APDU: 80 50 00 00 08 FC 81 DB FE 80 72 19 28
    DEBUG: Response APDU: 00 00 03 12 63 00 07 BB 03 00 FF 01 DA 26 EF 49 10 B7 72 00 9A 24 7F B4 A0 1F C7 C8 90 00
    INFO: INITIALIZE UPDATE Successful
    DEBUG: Command APDU: 84 82 00 00 10 D5 41 CE BE F4 A8 E4 DD 36 6C C5 3E 19 9C 77 93
    DEBUG: Response APDU: 90 00
    DEBUG: Command APDU: 84 82 00 00 08 D5 41 CE BE F4 A8 E4 DD
    DEBUG: Response APDU: 90 00
    INFO: External Authentication Successful
    DEBUG: packagePath: com/samptah/card/javacard/
    DEBUG: package: com.samptah.card
    DEBUG: package AID: 9C 25 F6 5E AB 3F
    DEBUG: applet AIDs: [9C 25 F6 5E AB CD ]
    DEBUG: Command APDU: 80 E6 02 00 13 06 9C 25 F6 5E AB 3F 08 A0 00 00 00 03 00 00 00 00 00 00
    DEBUG: Response APDU: 00 90 00
    DEBUG: Command APDU: 80 E8 00 00 FF C4 82 01 4C 01 00 10 DE CA FF ED 01 02 04 00 01 06 9C 25 F6 5E AB 3F 02 00 1F 00 10 00 1F 00 0A 00 15 00 2E 00 0C 00 7F 00 18 00 12 00 00 00 6F 00 02 00 01 00 0B 02 01 00 04 00 15 02 04 01 07 A0 00 00 00 62 01 01 00 01 07 A0 00 00 00 62 00 01 03 00 0A 01 06 9C 25 F6 5E AB CD 00 08 06 00 0C 00 80 03 00 FF 00 07 01 00 00 00 1C 07 00 7F 00 01 10 18 8C 00 00 7A 05 30 8F 00 01 3D 8C 00 02 18 1D 04 41 18 1D 25 8B 00 03 7A 02 23 18 8B 00 04 60 03 7A 19 8B 00 05 2D 1A 03 25 11 00 FF 53 5B 32 1A 04 25 11 00 FF 53 5B 29 04 1F 10 80 6A 08 11 6E 00 8D 00 06 16 04 75 00 10 00 01 00 00 00 09 18 19 8C 00 07 70 08 11 6D 00 8D 00 06 7A 05 22 19 8B 00 05 2D 7B 00 08 92 32 7B 00 08 03 1A 03 1F 8D 00 09 3B 19 03 1F 8B 00 0A 7A 08 00 18 00 02 00 01 00 01 03 00 0B 48 65 6C 6C
    DEBUG: Response APDU: 69 85
    net.sourceforge.gpj.cardservices.exceptions.GPLoadException: Load failed, SW: 69 85
    at net.sourceforge.gpj.cardservices.GlobalPlatformService.loadCapFile(GlobalPlatformService.java:707)
    at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(GlobalPlatformService.java:1675)
    at gpj.Main.main(Main.java:26)
    BUILD SUCCESSFUL (total time: 1 second)

    Quite similar problem here. Here's what I got from GPShell:
    enable_trace
    establish_context
    card_connect
    select -AID a0000000030000
    Command --> 00A4040007A0000000030000
    Wrapped command --> 00A4040007A0000000030000
    Response <-- 6F658408A000000003000000A5599F6501FF9F6E06479181023100734A06072A864
    886FC6B01600C060A2A864886FC6B02020101630906072A864886FC6B03640B06092A864886FC6B0
    40215650B06092B8510864864020103660C060A2B060104012A026E01029000
    open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4
    f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel
    Command --> 805000000804C1C46CBC9932AA00
    Wrapped command --> 805000000804C1C46CBC9932AA00
    Response <-- 000010700108859552580101AA4F3AEC5503E7A7435A0560E047AF489000
    Command --> 84820100100C2766279A1FC158181037B7A811AB93
    Wrapped command --> 84820100100C2766279A1FC158181037B7A811AB93
    Response <-- 9000
    delete -AID D0D1D2D3D4D50101
    Command --> 80E400000A4F08D0D1D2D3D4D5010100
    Wrapped command --> 84E40000124F08D0D1D2D3D4D501014018673D5E89975900
    Response <-- 6A88
    delete() returns 0x80206A88 (6A88: Referenced data not found.)
    delete -AID D0D1D2D3D4D501
    Command --> 80E40000094F07D0D1D2D3D4D50100
    Wrapped command --> 84E40000114F07D0D1D2D3D4D501887135A5C0B424D500
    Response <-- 6A88
    delete() returns 0x80206A88 (6A88: Referenced data not found.)
    delete -AID D0D1D2D3D4D50101
    Command --> 80E400000A4F08D0D1D2D3D4D5010100
    Wrapped command --> 84E40000124F08D0D1D2D3D4D501017144DF5DE0D2DE9F00
    Response <-- 6A88
    delete() returns 0x80206A88 (6A88: Referenced data not found.)
    install -file helloworld.cap -nvDataLimit 500 -instParam 00 -priv 2
    Command --> 80E602001907D0D1D2D3D4D50107A00000000300000006EF04C60201600000
    Wrapped command --> 84E602002107D0D1D2D3D4D50107A00000000300000006EF04C602016000
    C6EDAE8F91652A3B00
    Response <-- 6A88
    install_for_load() returns 0x80206A88 (6A88: Referenced data not found.)And this is what I've got from gpj
    Found terminals: [PC/SC terminal ACS ACR1281 1S Dual Reader ICC 0, PC/SC termina
    l ACS ACR1281 1S Dual Reader PICC 0, PC/SC terminal ACS ACR1281 1S Dual Reader S
    AM 0]
    Found card in terminal: ACS ACR1281 1S Dual Reader ICC 0
    ATR: 3B F8 18 00 00 81 31 FE 45 4A 43 4F 50 76 32 34 31 BC
    DEBUG: Command  APDU: 00 A4 04 00 07 A0 00 00 01 51 00 00
    DEBUG: Response APDU: 6A 82
    Failed to select Security Domain GP211 A0 00 00 01 51 00 00 , SW: 6A 82
    DEBUG: Command  APDU: 00 A4 04 00 08 A0 00 00 00 18 43 4D 00
    DEBUG: Response APDU: 6A 82
    Failed to select Security Domain GemaltoXpressPro A0 00 00 00 18 43 4D 00 , SW:
    6A 82
    DEBUG: Command  APDU: 00 A4 04 00 08 A0 00 00 00 03 00 00 00
    DEBUG: Response APDU: 6F 65 84 08 A0 00 00 00 03 00 00 00 A5 59 9F 65 01 FF 9F 6
    E 06 47 91 81 02 31 00 73 4A 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86
    FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B
    04 02 15 65 0B 06 09 2B 85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04 01 2A 0
    2 6E 01 02 90 00
    Successfully selected Security Domain OP201a A0 00 00 00 03 00 00 00
    DEBUG: Command  APDU: 80 50 00 00 08 A5 6A EB 5F E3 31 30 37
    DEBUG: Response APDU: 00 00 10 70 01 08 85 95 52 58 01 01 2E 43 22 1A A3 0A 65 4
    0 AA 8B D1 2A D5 89 8D 70 90 00
    DEBUG: Command  APDU: 84 82 00 00 10 B8 3A E1 AD 36 01 D8 E3 5F CC 77 B4 A7 F2 B
    E 68
    DEBUG: Response APDU: 90 00
    DEBUG: Command  APDU: 84 82 00 00 08 B8 3A E1 AD 36 01 D8 E3
    DEBUG: Response APDU: 90 00
    DEBUG: packagePath: com/tru/card/javacard/
    DEBUG: package: com.tru.card
    DEBUG: package AID: C3 79 3E 65 A1 00 EB F3 FD 20
    DEBUG: applet AIDs: [C3 79 3E 65 A1 C9 85 3B ]
    DEBUG: Command  APDU: 80 E6 02 00 17 0A C3 79 3E 65 A1 00 EB F3 FD 20 08 A0 00 0
    0 00 03 00 00 00 00 00 00
    DEBUG: Response APDU: 00 90 00
    DEBUG: Command  APDU: 80 E6 02 00 17 0A C3 79 3E 65 A1 00 EB F3 FD 20 08 A0 00 0
    0 00 03 00 00 00 00 00 00
    DEBUG: Response APDU: 00 90 00
    DEBUG: Command  APDU: 80 E8 00 00 FF C4 82 04 32 01 00 14 DE CA FF ED 01 02 04 0
    0 01 0A C3 79 3E 65 A1 00 EB F3 FD 20 02 00 1F 00 14 00 1F 00 0C 00 15 00 86 00
    12 02 CE 00 0A 00 53 00 00 00 F9 00 00 00 00 00 00 02 01 00 04 00 15 02 04 01 07
    A0 00 00 00 62 01 01 00 01 07 A0 00 00 00 62 00 01 03 00 0C 01 08 C3 79 3E 65 A
    1 C9 85 3B 00 01 06 00 12 00 80 03 0C 00 06 04 04 00 00 00 0C FF FF FF FF 01 27
    07 02 CE 00 02 30 8F 00 0C 3D 8C 00 0E 3B 7A 01 10 18 8C 00 0D AD 00 8B 00 0F 7A
    05 10 18 8C 00 10 18 10 08 88 01 18 11 3F 02 89 02 18 11 3F 03 89 03 18 11 3F 0
    4 89 04 18 11 3F 05 89 05 18 8B 00 1E 18 10 08 90 0B 3D 03 10 54 38 3D 04 10 52
    38 3D 05 10 55 38 3D 06 10 53 38 3D 07 10 4D 38 3D 08 10 41 38 3D 10 06 10 52 38
    3D 10 07 10 54 38 87 06 18 10 06 90 0B 3D 03 10 54 38 3D 04 10 53 38 3D 05 10 4
    3
    DEBUG: Response APDU: 6A 80
    DEBUG: Command  APDU: 80 E8 00 00 FF C4 82 04 32 01 00 14 DE CA FF ED 01 02 04 0
    0 01 0A C3 79 3E 65 A1 00 EB F3 FD 20 02 00 1F 00 14 00 1F 00 0C 00 15 00 86 00
    12 02 CE 00 0A 00 53 00 00 00 F9 00 00 00 00 00 00 02 01 00 04 00 15 02 04 01 07
    A0 00 00 00 62 01 01 00 01 07 A0 00 00 00 62 00 01 03 00 0C 01 08 C3 79 3E 65 A
    1 C9 85 3B 00 01 06 00 12 00 80 03 0C 00 06 04 04 00 00 00 0C FF FF FF FF 01 27
    07 02 CE 00 02 30 8F 00 0C 3D 8C 00 0E 3B 7A 01 10 18 8C 00 0D AD 00 8B 00 0F 7A
    05 10 18 8C 00 10 18 10 08 88 01 18 11 3F 02 89 02 18 11 3F 03 89 03 18 11 3F 0
    4 89 04 18 11 3F 05 89 05 18 8B 00 1E 18 10 08 90 0B 3D 03 10 54 38 3D 04 10 52
    38 3D 05 10 55 38 3D 06 10 53 38 3D 07 10 4D 38 3D 08 10 41 38 3D 10 06 10 52 38
    3D 10 07 10 54 38 87 06 18 10 06 90 0B 3D 03 10 54 38 3D 04 10 53 38 3D 05 10 4
    3
    DEBUG: Response APDU: 6A 80
    net.sourceforge.gpj.cardservices.exceptions.GPLoadException: Load failed, SW: 6A
    80
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.loadCapFile(Un
    known Source)
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
    ource)
    javax.smartcardio.CardNotPresentException: No card present
            at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
    ource)
    Caused by: sun.security.smartcardio.PCSCException: SCARD_W_REMOVED_CARD
            at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
            at sun.security.smartcardio.CardImpl.<init>(Unknown Source)
            ... 2 more
    Found card in terminal: ACS ACR1281 1S Dual Reader PICC 0
    java.lang.NullPointerException
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
    ource)
    javax.smartcardio.CardNotPresentException: No card present
            at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
    ource)
    Caused by: sun.security.smartcardio.PCSCException: SCARD_W_REMOVED_CARD
            at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
            at sun.security.smartcardio.CardImpl.<init>(Unknown Source)
            ... 2 more
    Found card in terminal: ACS ACR1281 1S Dual Reader SAM 0
    java.lang.NullPointerException
            at net.sourceforge.gpj.cardservices.GlobalPlatformService.main(Unknown S
    ource)What can I do to fix this? Did I missed any steps? Thanks for any reply.

  • Cannot load image from computer - freezes @ 50% each time

    Can someone help with this problem. I have saved it and come back to it.  Have tried to upload different images from my saved files on the computer.
    No luck. Each time I try, it jumps to 50% loading and never loads anthing - this is using the Forms Central in Adobe. 
    Thanks.

    Hey I see this is an older post, but I am having the same issue.  I am using the desktop app Fromscentral and I am trying to insert an image, a very small image, and I have tried both tiff and jpg versons of it, just a small logo that is like 10K file size and only ablut an inch in size, and it is stopping t 50% downloaded, exactly as the user above described.  I am using MacOS 10.8.4 and an up-to-date Firefox browser and jsut recently acquired the full creative suite. 
    Also, Josh one little thing that would be VERY helpful for new users is that when you want to open and continue editing a form you have already begun, in the Acrobat Pro open/creat menus, the main strating place, it should have an option for not just create form but 'Open My Forms".  It was very frustrating earlier not to know how to get to a form I had already spent a lot of time on.  When youa re in formscentral it appears you have no control over where the form document itself (pre-pdf) is being saved.  Acrobat (or rather, formscentral) doesn't tell you that.  Is it only being saved online int he cloud?  This should not be happening.  I was told specifically when I purchased the suite that even though it is called 'cloud' you can save all files you creat locally.  It is a big probelm if that is false and misleading, both for the work I want to do and for the trustworthiness of your company and its reputation.
    Maybe I am wrong and just don't know the software well enough yet, but it already seems like the interface and lack of transparency in where and how it saves things is designed to bully one into 'upgrading' to be able to do more with forms.  I expected to at least be able to do everything I could do in version 9 and to do so at least as easily.  I don't mind a learning curve, but I don't like that I can't hit 'save as' when I am working with form creation and know exactly where it is and open it directly.  That's alsways been one of the GOOD things about Adobe - they haven't fallen into the Microsoft software crap - excuse me, TRAP - of trying to figure out for you what they think you will want to do with the software in every instance including save and storage controls.  Perception is reality, so if there is marketing/sales as the impetus for how this is structured now, Adobe is shooting itself in the foot.  That's not how it got to where it is.  Just my 2 cents, in addition to my question buried back up top. 

  • [MIDP2.0] Cannot Load Image

    The following is the code I used
    public class GraphicsLoader {
      static Image myImage;
      public GraphicsLoader() {
        try {
          myImage = Image.createImage("/images.png"); // <---- Null Pointer Exception
        } catch (IOException ioEx){
          ioEx.printStackTrace();
      }Which I have placed the images.png in the same directory as the classfiles, but it couldn't be loaded! I really do not understand why.

    Hi!
    Your image should be in res folder. You java file is in source folder

  • Beginner question: cannot load image

    Hi, I'm trying to load an image in my java program.
    I use this code to test:
    Toolkit tk = Toolkit.getDefaultToolkit();
    image = tk.getImage("test.png");
    JOptionPane.showMessageDialog(null, Integer.toString(image.getWidth(null)));
    But image.getWidth(null) returns -1
    "test.png" is in the same directory as the .jar file.

    The image is not 'loaded' yet, and the size is not yet known.
    That is why getWidth returns -1. This is described in the javadoc of the getWidth() method.
    If you for instance do this:
    Toolkit tk = Toolkit.getDefaultToolkit();
    Image image = tk.getImage("test.png");
    new ImageIcon(image);
    JOptionPane.showMessageDialog(null, Integer.toString(image.getWidth(null)));it should return the width of the image (if the image file is actually found that is)
    - Roy

  • Cannot load image from applicationStorageDirectory

    Hi!
    At program startup I load binary data of images from a remote server and save them locally in my applicationStorageDirectory:
    imageFile = new File(File.applicationStorageDirectory.nativePath);
    imageFile = imageFile.resolvePath("images/" + obj.id + extension);
    var filestream:FileStream = new FileStream();
    filestream.open(imageFile, FileMode.WRITE);
    filestream.writeBytes(loader.data);
    filestream.close();
    later, when I need the image for display reasons, I try to load them from my applicationStorageDirectory:
    file = new File(File.applicationStorageDirectory.nativePath);
    file = file.resolvePath("images/" + obj.id + extension);
    image.load(new URLRequest(file.nativePath));
    I made an output with both urls and they are identical. Nonetheless the image fails to load with error #2035.
    In the desktop version of this application I store images in and load them from the applicationDirectory. This works fine!
    Can anybody help?
    Judith

    I found the solution myself. If I want to load a file from the applicationStorageDirectory I must not reference it with file.nativePath but file.url !
    judith

  • Loading Images in Applets

    Is it possible to use the Toolkit class to load images in "unsigned" applets. I tried that but it throws a security exception:
    com.ms.security.SecurityExceptionEx[MyApplet.init]: cannot access file http://localhost/MyApplet/images/Image1.gif
    Though I am reading the image from the server not the client machine.
    Any help would be appreciated.
    Thanks in advance,
    Samer Meqdad

    Here's the code:
    Image img;
    img = Toolkit.getDefaultToolkit ().getImage (getCodeBase() +  "images/MyImage.gif");The exception thrown is:
    com.ms.security.SecurityExceptionEx[Host]: java.io.IOException: bad path: C:\Documents and Settings\samerm\Desktop\file:\C:\MyApplet\images\MyImage.gif
         at com/ms/security/permissions/FileIOPermission.check (FileIOPermission.java)
         at com/ms/security/PolicyEngine.deepCheck (PolicyEngine.java)
         at com/ms/security/PolicyEngine.checkPermission (PolicyEngine.java)
         at com/ms/security/StandardSecurityManager.chk (StandardSecurityManager.java)
         at com/ms/security/StandardSecurityManager.checkRead (StandardSecurityManager.java)
         at com/ms/awt/WToolkit.getImageFromHash (WToolkit.java)
         at com/ms/awt/WToolkit.getImage (WToolkit.java)
         at DiamondsApplet.init (DiamondsApplet.java:54)
         at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java)
         at com/ms/applet/AppletPanel.securedCall (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
         at com/ms/applet/AppletPanel.run (AppletPanel.java)
         at java/lang/Thread.run (Thread.java)

  • Loading Images with 1.3.1 Problem

    Hi!
    I've got a couple of swing applets that use Images. One uses the images for icons and one just draws the images. The images are loaded from jar files. Using version 1.3.0, everything works fine. When I load the applet using 1.3.1 or 1.4, however, the images do not appear on the screen. According to the Java Console, the images did load. I saw messages like:
    Loaded image: jar:file:/C:/rgajava/MKSLeak/jar/leak.htmlMKSLeak.jar!/images/audiooff.gif
    Loaded image: jar:file:/C:/rgajava/MKSLeak/jar/leak.htmlMKSLeak.jar!/images/audioon.gif
    that were displayed when I upped the trace level. The images still do not appear.
    Does anyone know how to fix this? I am loading the images using getImage(URL,String).
    Thanks,
    Derek

    As a partial answer to my own question, the Java tutorial declares that some browsers cannot load images from jar files. This appears to be the case with IE5.5 and Java 1.3.1, but it is strange that IE5.5 and Java 1.3.0 seem to have no problem. Nevertheless, the applet works well and images load if the images are accessed outside of the jar file.
    Derek

Maybe you are looking for