Optimizing for a smaller .cod (.jar) file
.cod-file, blackberry, java-me
Solution
Good question!
- Compression (GZip, ZLib) may be useful when installing large bin/txt/xml files
And that's what they say in RIM:
- Setting appropriate access
- Avoid creating interfaces
- Use static inner classes
- Avoid unnecessary field initialization
- Import individual classes
Also, interesting facts:
All images was PNG format. I want to know why : compile with JDE 4.5 --> 900k, compile JDE 4.2, 2.6.1, 4.7 --> 1800k. What is difference ? Thanks !
Seems that JDE 4.5 uses more optimization techniques than older JDE versions.
Check the image below, it produced by PngOut from 55 K png image. It's size is 3427 bytes
Problem
The RIM compiler performs extra optimization and compression on the resulting ".jar" while building the final .cod file, but there are things that can be done by the developer to significantly reduce the final .cod file size. One such thing would be to run PNGCrush, OptiPNG, or a similar tool to reduce the size of the included .png files. In an application with a large number of image files (such as an app featuring a custom UI), this can yield a significant reduction in the final .cod file size. How can I optimize the final .cod file for size? Something to be done in the .java code itself? Something to be done in the project structure? Something to be done to the files or resources?