Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User epelde's Avatar
    Join Date
    Mar 2003
    Posts
    2
    I have an image wich I wanna load from a file, but I can't because I have a "java.io.IOException: Cannot read file" at runtime. I have a method like this to load the image:

    private Image loadImageFile(String file)
    {
    try
    {
    return ((Image) Image.createImage(file));
    }
    catch(IOException e)
    {
    System.out.println("Can't load image " + file);
    System.out.println("mensaje:" + e.getMessage());
    e.printStackTrace();
    return null;
    }

    and I call it this way "splash = this.loadImageFile("/logo.png""
    What's going wrong?My image files are in a "res" named directory and I this code used to work properly a few days ago.
    Any ideas?

  2. #2
    Registered User alexwei's Avatar
    Join Date
    Mar 2003
    Posts
    5
    you said that your image files are in a "res"directory, but i always put my image files in a "class" or a "src" directory.

  3. #3
    Regular Contributor marcgom's Avatar
    Join Date
    Mar 2003
    Location
    Rome, Italy
    Posts
    53
    hi,
    i've my images in the res directory,
    when you build the jar file with nokia dev suite,
    you have to include images in the project.
    have you done this?

  4. #4
    Registered User isomaltine's Avatar
    Join Date
    Mar 2003
    Posts
    9
    If your source code is in a package you'll have to prepend that package name in front of the .png file name in order for your program to find them. Use winzip to have a look inside the .jar file so you can see what the structure is.

    Isomaltine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved