Unification of .jar and .jad files in a J2ME application

余生长醉 提交于 2019-12-13 05:36:28

问题


currently, I am developing a J2ME application for mobiles using LWUIT library. The build result of my project includes a .jar file along with a .jad file. I wonder, is there any way to unify these to files into a single .jar file? Why some properties of my application should be mentioned in a single (and simple) .jad file instead of the METAINF/manifest.mf file of the jar file? It really makes the deployment process more difficult.


回答1:


There are historical reasons for the separate .jar and .jad files (even the whole J2ME platform is historical, too :)).

As this learning material describes, .jar files contain the application logic and resources, and .jad files contain the metadata (name, author, version, requirements etc.) of the application along with its download URL. Back in the time, when mobile bandwidth was very expensive, it was completely reasonable to download only the metadata (.jad file) of the application first as it was much smaller. Then, if the mobile phone satisfied the requirements, and no newer version of the application was installed, the actual download of the application (.jar file) could take place.

Nowadays, this bandwidth issue is not relevant and most J2ME build environments encloses the metadata also in the META-INF/manifest.mf entry of the .jar file, and produces the .jad file as a by-product of the build process for compatibility reasons.

I think almost every modern mobile phone that supports J2ME is able to install and run the application using only the .jar file, you just copy that to the phone and run it, no .jad file is needed. So, to answer your question, instead of trying to "unify" these two files, you can just simply ignore the .jad.

However, when you really need to get rid of the .jad file, you must look around the build settings of your development environment (for example NetBeans), there may be a checkbox or a switch that disables the production of the .jad file, or even a property page where you can edit the entries included in the application manifest (manifest.mf file). But this depends on the development environment you use and there is no general J2ME solution to this.



来源:https://stackoverflow.com/questions/8869288/unification-of-jar-and-jad-files-in-a-j2me-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!