Oct 232006
 

Anybody who has developed mobile application using J2ME must already know that getting the smallest JAR file size is very important.

This is because the limit imposed by the mobile phone devices due to storage/memory limit on small devices. It is not unusual for you to get mobile devices with 32KB ,64KB or 256KB jar file limit.

This is where JAR file optimization is crucial for deploying your J2ME mobile application out in the wild. Here’s a few thing that you can do to reduce your JAR file size :

Optimise PNG files

PNG is a graphic format used primarily by J2ME devices, and is guaranteed to be cross-platform between mobile devices that implements J2ME.

The best part with PNG file is that its bitmap data is compressed using the deflate compression algorithm which can be easily optimised by easily obtainable tool :

Obfuscation

Obfuscation does help in chopping unecessary code, renaming long variables and classes, thus making the class files smaller. Don’t forget to Obfuscate your package files before deployment.

It does not only protect your code, but it does save a lot of valueable space.

Proguard and RetroGuard is the most common obfuscator used in J2ME application

Recompress JAR files

Finally, after going through optimizing PNG files and obfuscating, you might want to try to recompress your JAR files using a tuned JAR compressor which favors size over speed. For this purpose, I prefer using KJar, a JAR file recompressor based on Ken Silverman’s KZIP.
This final step combined with previous optimisation will greatly reduces your JAR file, personally I’ve achieve 33% space saving by reducing my resulting JAR file size from 80KB to 53KB (27KB saving !)

Please visit SupremeJ2ME website for more information about optimising your J2ME application for size.

[tags]j2me,javame,mobile,jar,java,nokia,programming,optimization[/tags]

  13 Responses to “J2ME: How to optimize JAR file size”

  1. [...] J2ME: How to optimise your JAR file size Optimise PNG files. PNG is a graphic format used primarily by J2ME devices, and is guaranteed to be cross-platform between mobile devices that implements J2ME. The best part with PNG file is that its bitmap data is compressed using the … Related:  • J2ME • How • to • optimise • your • JAR • file • size [...]

  2. Kjar has virus !!!

  3. According to Norton Internet Security, KJar has some sort of Trojan in it.

    Pity, since it took about 5% off a jar file.

    The Supreme J2ME web site is down at the moment so that might be the end of KJar.

  4. The application decompress KZip application that it uses during runtime, that is what triggered the Anti-virus alarm as the same technique is being used by trojan application.

  5. [...] J2ME: How to optimize JAR file size : Mobile Programming Pit StopAnybody who has developed mobile application using J2ME must already know that getting the smallest JAR file size is very important. … [...]

  6. The Supreme J2ME web site just posted last January 2007 that antivirus companies have been notified about it. It’s not a trojan or virus. It just has a signature like one because of the overwriting thing it does.

  7. thanks for share information. this site is very nice.
    for java hacking try visit here
    sory my english is bad

  8. thanx for nice article…,good job dab..
    @ pangeran kodok

  9. good2.

  10. Just purchased a Mythic for myself and will be having one particular for my wife quickly! It has just the appropriate mix of features. just brief of a complete smartphone. I’m preserving an eye about the Captivate for a potential future cellphone..
    .selling prices are way as well higher when released. I’ve been in high tech for 20+ many years and fundamentally hack almost everything I own to produce it superior laptops, GPS, automobile navigation systems, and so on. and yes cell phones as well. Within the handful of days I’ve owned the cellphone I have currently set up Opera Mini, Bolt 2.1, freecaddie, Google Maps w/GPS functionality, deleted all locked useless apps after backing them up and absolutely modified the menu process to my exact requirements devoid of all ineffective apps.

  11. Interesting site man Thank you

  12. Download Free Drug Lord 2game order prozac
    Prozac has become one of the most popular and familiar antidepressants on the market.
    http://massmlmtraffic.com/ – fluoxetine 20 mg

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This blog is protected by dr Dave\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'s Spam Karma 2: 274049 Spams eaten and counting...