private static byte[] pack(byte[] data, File path) throws IOException
    {
        JarInputStream in = new JarInputStream(new ByteArrayInputStream(data))
        {
            @Override
            public ZipEntry getNextEntry() throws IOException
            {
                ZipEntry ret = super.getNextEntry();
                while(ret != null && ret.getName().startsWith("META-INF"))
                {
                    ret = super.getNextEntry();
                }
                return ret;
            }
        };
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        Packer packer = Pack200.newPacker();

        SortedMap<String, String> props = packer.properties();
        props.put(Packer.EFFORT, "9");
        props.put(Packer.KEEP_FILE_ORDER, Packer.TRUE);
        props.put(Packer.UNKNOWN_ATTRIBUTE, Packer.PASS);

        final PrintStream err = new PrintStream(System.err);
        System.setErr(new PrintStream(NULL_OUT));
        packer.pack(in, out);
        System.setErr(err);

        in.close();
        out.close();

        byte[] packed = out.toByteArray();
        if(DEBUG_SAVE_STAGES)
        {
            Files.write(packed, new File(path.getAbsolutePath() + ".pack"));
        }
        return packed;
    }