Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Pack200 snagette

Java 2006 Pack200

I've hit a small problem in the Pack200 implementation. For some reason, the factory that instantiates the Pack200 unpacker can't find the Pack200 implementation, unless the implementation is on the bootclasspath. I figure that this is almost certainly a bug in the basic classloader implementation:

package pack200.bug;
public class Bug implements Unpacker {
  public static void main(String[] args) throws Exception {
    System.out.println("Loading class: " + Class.forName(pack200.bug.Bug.class.getName()));
    System.out.println("Implements Pack200.Unpacker: " + (pack200.bug.Bug.class.newInstance() instanceof Pack200.Unpacker));
    System.setProperty("java.util.jar.Pack200.Unpacker", "pack200.bug.Bug");
    System.out.println(Pack200.newUnpacker());
  }
}

Export this to a Jar, and run it -- it fails unless the Jar is also on the bootclasspath. It means that there may be little point in trying to instantiate via the standard property, and you might just as well use the Pack200 code directly. In any case, since it's being developed for pre 1.5 systems, and the 1.5 systems don't have the Pack200 factory, it may be something that is a moot point anyway.