×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    80

    createImage problem in J2ME

    Hi,
    Trying to show an image from my midlet but for some reason it throw the exception.
    Can any body point me the reason, I use Eclipse. Where the image duke.png should be located in folder?

    try{
    im = Image.createImage("/duke.png");
    }catch(Exception e){
    System.out.println("** Error creating image");
    }

    Thanks

  2. #2
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: createImage problem in J2ME

    it should be located at the root of your jar. (usually, you have a "res" folder that is included in the build path, this is where ressources go).

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: createImage problem in J2ME

    Quote Originally Posted by aktarjahan2003 View Post
    Hi,
    Trying to show an image from my midlet but for some reason it throw the exception.
    Can any body point me the reason, I use Eclipse. Where the image duke.png should be located in folder?

    try{
    im = Image.createImage("/duke.png");
    }catch(Exception e){
    System.out.println("** Error creating image");
    }

    Thanks
    If your issue does not get resolved even after following the post from njzk2, What is the exception you are getting?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    80

    Re: createImage problem in J2ME

    I got the exception
    System.out.println("** Error creating image"); -> this is printed in console.

    I tried to put the copy of duke.png in all folder (smaller, bigger letter etc but did not help.)

  5. #5
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: createImage problem in J2ME

    by exception, raj means the exception that you catch.
    try something, like e.printStackTrace() ...

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: createImage problem in J2ME

    Quote Originally Posted by aktarjahan2003 View Post
    I got the exception
    System.out.println("** Error creating image"); -> this is printed in console.

    I tried to put the copy of duke.png in all folder (smaller, bigger letter etc but did not help.)
    As you are working with the Eclipse IDE, there will one res folder inside the project. Put the image here. Make sure that while you are trying to create the image, you are typing the exact name of the image inside the code, duke.png.
    PHP Code:
    try{
    im Image.createImage("/duke.png");
    }catch(
    Exception e){
    System.out.println("** Error creating image");

    Please check, this must work.Also check the extension of the image, whether this is in lower or upper case.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor
    Join Date
    Jul 2008
    Location
    Faridabad(Delhi NCR)
    Posts
    343

    Re: createImage problem in J2ME

    do wat Raj is saying if you still get problem then check what is the extension of the image. Like if you create your image on paint the its extension is Like .PNG which is different from .png . Try to check it may be you change .PNG to .png this problem coming many time.

    or try to create image by

    im = Image.createImage("/duke.PNG");
    Anshu Chauhan
    J2me Developer

Similar Threads

  1. j2me createImage(Inputstream stream) problem
    By asifsanli in forum Mobile Java General
    Replies: 8
    Last Post: 2011-01-15, 12:11
  2. svg createImage from InputStream problem
    By xylia in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2009-03-20, 10:36
  3. Problem with Image.createImage() method
    By vishaljaiswal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2007-04-25, 15:34
  4. Problem with CreateImage
    By maghal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 11
    Last Post: 2006-10-19, 14:38
  5. DirectUtils.createImage Transparency problem
    By pippopippi in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-03-22, 00:18

Posting Permissions

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