newbie: j2me, adding resources to midlet

Discussion in 'Java' started by Jeff, Oct 10, 2005.

  1. Jeff

    Jeff Guest

    Hey

    midp 2.0
    J2ME Wireless Toolkit 2.2
    JDK 5

    Excuse me if my question is a bit stupid but I'm a newbie...

    I'm programming a midlet that needs some image files (.png)... my problem is
    that I don't know how to add those image files to the project... I'm using
    KToolbar and I cannot see how to add image files via KToolbar....

    Have anyone of you some tips for me about this, then please send it to
    me....
    a link would be great, as I've spent hours searching the net

    Best Regards

    Jeff
     
    Jeff, Oct 10, 2005
    #1
    1. Advertisements

  2. It's actually as easy as adding files to the .jar file. For instance,
    here are some ant tasks I use in Hecl (www.hecl.org):

    <jar destfile="j2me/Hecl.jar" basedir="j2me/" includes="script.hcl"
    update="true"/>
    <jar destfile="j2me/Hecl.jar" basedir="j2me/" includes="Hecl.png"
    update="true"/>

    You could use the 'jar' command directly too if you look up the command
    line options to add a file to the archive.

    Ciao,
    --
    David N. Welton
    - http://www.dedasys.com/davidw/

    Linux, Open Source Consulting
    - http://www.dedasys.com/
     
    David N. Welton, Oct 11, 2005
    #2
    1. Advertisements

  3. Put the files into the res directory under your application's directory,
    and reference them with "/res/filename".
     
    Darryl L. Pierce, Oct 11, 2005
    #3
  4. He asked how to add them to his Wireless Toolkit environment, which
    requires them to be placed into the /res/ directory for the project. So,
    no, throwing them into a JAR doesn't solve his problem.
     
    Darryl L. Pierce, Oct 12, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.