×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Can't include png file into jar file when create MIDlet suite

    I tried to create MIDlet suite with Forte:
    Tool --> Nokia ... --> Create MIDlet Suite

    In "Resource Files" tab I found all png files that I want to include them into my jar file but when I click OK button it's pop up message like this "Can't file resource file +(my png file)" but at last I can create jar file but it didn't have any png files inside.
    I don't know what to do so help me!

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    RE: Can't include png file into jar file when create MIDlet suite

    Same problem :'(

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    RE: Can't include png file into jar file when create MIDlet suite

    If you placed png files and java source files together in the same
    directory, Jar file would not contain png files.

    I suggest you make 'res' directory and 'src' directory in the root directory, in which png files and java source files are placed seperately.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    RE: Can't include png file into jar file when create MIDlet suite

    It seems that you need two identical copies of your resources files, one in the 'res' folder, and one in the Java source folder. It uses one copy when you specifiy which resources to include in the Jar, and the other copy when it actually creates the jar. Weird!

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    RE: Can't include png file into jar file when create MIDlet suite

    I have same problem, tic tac toe Nokia example not display circle, cross in list.

  6. #6
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Tampere / Finland
    Posts
    201

    RE: Can't include png file into jar file when create MIDlet suite

    Hello,

    I use JBuider6 + MobileSet2 + Nokia Developers' Suite. There are two ways to include png in JAR. #1 If you use JBuilder -> Wizards -> Archive Builder to create MIDlet, you can save png files into classes directory, which also contains Java class files. #2 If you'd like to create MIDlet using Tools -> Nokia Developers' Suite for J2ME -> Create Application Package, you have to create a rcs directory manually and put all the png files into it.

    Regards

    Wang Kui / Forum Nokia

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    RE: Can't include png file into jar file when create MIDlet suite

    Including resources in a project:

    (This post assumes you have set up a project preferrably with JBuilder or some other tool which integrates the Nokia Developer Suite)

    Check the following:

    Prepend a '/' (as in slash) to your filename to use it like this:

    private Image icon;
    icon = Image.createImage("/myfile.png"

    For exception handling reasons all must be placed in a try-catch clause:

    private Image icon;
    try {
    icons = Image.createImage("/myfile.png"
    } catch(IOException e) {
    System.out.println("Icon not loaded!"
    }

    When starting the app your console spawns "Icon not loaded!" you should check the following:

    Create a folder called 'res' in the project's root folder, on the same level as 'src' and 'classes'.
    Using Nokia Developer Suite, Images and other resources should be placed in 'res' so they will
    be visible from 'Tools -> NDS -> Create Application Package -> Resource Files -> Add' and thus
    may be included in the .jar file.

    Build your project: e.g. ctrl + F9
    Tools -> NDS -> Create Application Package -> OK

    Run your project either by:
    project view (ctrl + alt + p) right clicking *.jad -> Micro Run
    or
    selecting *.jad in the project view (ctrl + alt + p) and clicking
    Tools -> NDS -> Start Emulators

    Attention!!!
    In JBuilder, when running your project by rightClicking your 'MIDlet' class -> MicroRun, your application may still not show and load icons (or other resources) properly...(even if you have previously added the necessary resource files by rightClicking projectname.jpx -> Add files/packages...anyone know why?)

    To check whether your resource files are in the jar file: (WinZip installed)
    Rename *.jar to *.zip -> right click -> Extract to... -> WinZip shows contents

  8. #8
    Registered User
    Join Date
    Aug 2008
    Posts
    1

    Re: Can't include png file into jar file when create MIDlet suite

    dear please go to the project and right click > properties> application Descriptor , and change ICon in netbean

Posting Permissions

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