1.5 之前的 jre 上是否有 pack200 的向后移植?
是否有1.5 之前的 JRE(1.3 或 1.4)的库或附加组件可以解压缩并运行 pack200 打包的 JAR?
编辑:
我需要这个,因为我正在为旧版 Java 1.3 环境编写一个小程序,并且我想通过尽可能压缩 jar 来节省带宽。
Is there a library or add-on for pre-1.5 JRE (1.3 or 1.4) that can uncompress and run pack200-packed JARs?
EDIT:
I need this because I'm writing an applet for a legacy Java 1.3 environment, and I want to save bandwidth by compressing the jar as much as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,没有。然而,这只是你的问题的一部分。
pack200 存档的内容很可能是使用 JDK 1.6 编译的。即使您可以将 pack200 存档的解压链接到类加载器中,您的 JVM 也很有可能会抱怨它无法理解这些 1.6 版本编译的类文件(因为该版本是在 1.5 JVM 发布之后编写的)释放)。
现在,如果您保证内容与 JRE 1.5 兼容,那么如果您确实想使用 pack200(或其他更好的压缩存档文件格式),则必须使用您自己的自定义
ClassLoader
,这将使您可以完全控制查找课程。这将允许您解压缩存档并在类查找期间搜索它。除非这是您软件的一个关键功能,否则您很有可能坚持为 1.5 版本提供 JAR 文件。
No there isn't. However, that is only part of your problem.
There is a high likelihood that the contents of the pack200 archive were compiled with JDK 1.6. Even if you could chain in the decompression of the pack200 archive into the class loader, odds are excellent that then your JVM would be complaining that it can't understand these version 1.6 compiled class files (because that version was penned AFTER the 1.5 JVM was released).
Now, if you are guaranteeing that the contents are JRE 1.5 compatible, then if you really want to use pack200 (or some other better compressing archive file format), you'll have to work in your own custom
ClassLoader
, which will give you full control over finding the classes. That will allow you to uncompress the archive and search it during class look ups.Unless this is a key feature of your software, odds are excellent that you should stick to delivering JAR files for 1.5.