Search code examples
javabackwards-compatibility

Is there a back-port of pack200 on pre-1.5 jre?


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.


Solution

  • 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.