Results 1 to 2 of 2
  1. #1
    Peetahzee is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default Putting Applet on web with images

    I have an applet that loads images from a folder:
    Java Code:
    private Image img;
    img = Toolkit.getDefaultToolkit().getImage("images/"+this.getClass().getName()+color+".png");
    And now I want to put this applet online. The java program successfully loaded I believe, but I get an exception in the status bar saying this:

    I tried putting the folder "images" in the same directory as the .class's, but it doesn't work. Any ideas?

    Thanks in advanced.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power


    An Applet nor a JApplet can do what it wants on a client machine, e.g. it can't read files there; it has to load its resources (e.g. an image) from the server it was loaded from itself. Have a look at the Class.getResourceAsStream( ... ) method.

    kind regards,


Similar Threads

  1. [Applet] Clicking images & moving them.
    By Perfectworld in forum Java Applets
    Replies: 17
    Last Post: 01-16-2010, 08:09 AM
  2. Extract images from Java applet
    By User01 in forum Java Applets
    Replies: 2
    Last Post: 12-23-2009, 06:44 AM
  3. Applet with Images in Browser
    By baron in forum Eclipse
    Replies: 0
    Last Post: 09-20-2009, 10:06 PM
  4. Putting Image into Java applet
    By SprayAndPray69 in forum New To Java
    Replies: 1
    Last Post: 02-13-2009, 06:14 AM
  5. Putting your own type in a Set
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-15-2008, 07:32 PM

Posting Permissions

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