Regarding Reducing the jar size

Hi, :smiley:

       I am having problem in reducing the jar size, If you have any idea please let me know. it may be Image size reduction or Code size Redution. for that Image iknow Clipping, if u know  any new idea pls let me know
  1. If you know that a class variable will not change, make it ā€œstatic finalā€.

  2. Use as few methods as possible.

  3. Use as few classes as possible.

  4. Use method instance variables over class instance variables. Note: Jury is still out on this for me. Iā€™ve seen a reduction using this technique, but not sure if it was truly the idea or the obfuscator made the difference.

  5. Use something like ProGuard to further obfuscate and reduce your code.

Other? I am relatively new to J2ME development, too, so I am still learning the tricks of the trade as I go along. :slight_smile:

Hereā€™s another article that talks about optimization a little more ā€¦

http://www-106.ibm.com/developerworks/wireless/library/wi-pvcperf/

@jeevan_gr

It might be a good idea to give us some more information.

Tell us how many classes and images you have. What kind the images areā€¦ how you organized emā€¦ wich formatā€¦ how big the palette is.

Also tell us how big that files are and how small it should be etc.

Finally a rule of thumb hintā€¦ use an obfuscator or even twoā€¦ for example the Jax + Jarg combo was quite nice for the 4k game contest. Also 7zip compresses damn well (use ā€œultraā€). Oh and if you use png images crunch em as much as possible with pngout (by Ken Silverman - thatā€™s the guy who made the Build engine used by Duke Nukem 3D btw ;)).

On older KVM implementations, the over head for every class and interface is something like .5K :frowning:

Unfortunately given the incredible limits those same had sets have on MIDLET size (as little as 64K) the best answer I can give for those environments is to abandon much of your OOP.

Donā€™t use interfaces at all. Limit yourself to the absolute smallest number of classes you can get away with without making your code totally impossible to maintain. Obfuscate to reduce namespace. Those are the biggies.

If you have a lot of images you may want to look at how you are encoding them and do things like reduce the bit-depth, depending on your targetā€™s capabilitiesā€¦