views:

166

answers:

2

In a NetBeans Mobility Project I have attached a zip file to the Resources folder,

this zip file contains around 10 .class files.

In my mobility application I am actually using 4 classes from the zip file, however when I compile and build my project the destination jar file seems to contain all the 10 .class files from the zip file.

I had the perception that only class files that are used by the application are compiled into the final jar. What could be going wrong?

A: 

I think you are making a false assumption about what netbeans will do with your attached resource file. It won't automatically figure out which ones you are using and which you aren't. There may be third party tools to help, though.

jsight
+3  A: 

Try using proguard on the jar to automatically remove classes not used by your midlet class.

izb
I set obfuscation level to max, and the jar file has now reduced to half its original size, and even the fewer class files are showing into the final jar.But I dont understand why the classes that I have used are not figuring into the final jar.
Kevin Boyd
Proguard renames the classes in the process of obfuscation and shrinking. If you want to keep the classnames, use the keepattributes flag while obfuscation. See Proguard documentation for the various options
Ram