为什么运行应用程序时 jar 文件大小会增加?
我正在使用 j2me 开发移动应用程序。在我的移动应用程序中,我通过蓝牙与另一台设备连接并执行一些操作。
在我的移动应用程序中,jar 文件大小为 80KB
我将应用程序部署在“Nokia c2-00”移动设备中。当我执行应用程序时,jar 文件的内存每次都会增加。每次执行应用程序时,jar 文件大小都会增加 5 到 10 KB。
例如,我在诺基亚手机中部署应用程序(当时手机上的 jar 大小为 80KB),运行并退出应用程序后,我检查大小(它将变为 85 KB,之后增加到 90KB,等等)尺寸增大。
我不明白为什么我的应用程序大小增加了。请帮助我找出 jar 文件大小增加的原因以及如何阻止它这样做。
I'm developing a mobile application using j2me. In my mobile app I connect with another device through bluetooth and perform some operations.
In my mobile application the jar file size is 80KB
I deploy the application in "Nokia c2-00" mobile. When I execute the application the memory of the jar file increases every time. Each time I execute the application the jar file size increases by 5 to 10 KB.
For example I deploy the application in nokia phone (At that time the jar size is 80KB on the mobile) and after running and exiting the application I check the size (it will become 85 KB, after that it increases to 90KB, etc) the size is increased.
I cannot understand why my app size is increased. Please help me figure out why the jar file is increasing in size and how to stop it from doing that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的应用程序在做什么?我之前在诺基亚 S40 手机上部署 MIDlet 时就见过这种现象,我将其归因于应用程序将数据写入 RMS。因此,显示屏显示 JAR 和 MIDlet 本身消耗的空间。
这听起来像是可能发生的事情吗?
What kind of thing is your app doing? I have seen this phenomenon when deploying MIDlets to Nokia S40 handsets before, and I attributed it to the app writing data to RMS. So the display is showing space consumed by the JAR, and by the MIDlet itself.
Does this sound like what could be happening?
将膨胀/扩展的 JAR 文件的副本移回您的开发平台,将其解压缩并将其与原始 JAR 内容进行比较,以查看发生了什么更改。
您的应用程序或应用程序正在使用的某些库中的某些内容可能会向 JAR 添加一些包含某些状态的文件。这是一件坏事。 ZIP/JAR 文件的格式不允许就地重写组件文件。相反,必须附加新版本的组件文件...导致 JAR 文件不断增长。
Move a copy of the inflated / expanded JAR file back to your development platform, extract it and compare it with the original JAR contents to see what is being changed.
Something in your app or some library that your app is using may be adding some file containing some state to the JAR. That's a bad thing to do. The format of a ZIP/JAR file doesn't allow component files to be rewritten in-place. Instead, the new version of the component file has to be appended ... resulting in the JAR file growing.
这是一个奇怪的案例。一旦安装,jar 就不会增长...为了使 jar 增长,必须将其内容解压并与附加文件一起重新打包到新的 jar 文件中。这种情况不太可能发生。
不管怎样,你能分享一下你的jar和jad文件吗?我正在考虑自己测试一下。
This is a weird case. The jar should not grow once it is installed... For the jar to grow, its contents must be unpacked and re-packed together with the additional files into a new jar file. This scenario is unlikely to happen.
Anyway, can you share your jar and jad file? I'm thinking of testing this myself.