In case you are running into Out Of Memory, (especially on windows), you can try changing your JVM heap size. You can do this using ant's ANT_OPTS as below, and then invoke the ant pack-all target.

set ANT_OPTS=-Xmx512m

In case you are interested in signing your compressed file, then you may need to pack, unpack and then repack your jar. This extra step is needed since Pack200 rearranges the contents of the resultant JAR file. The jarsigner hashes the contents of the class file and stores the hash in an encrypted digest in the manifest. When the unpacker runs on a packed packed, the contents of the classes will be rearranged and thus invalidate the signature. Therefore, the JAR file must be normalized first using pack200 and unpack200, and thereafter signed. Here is how this repackaging can be done: