This ANT task allows you to use a <fileset> to specify the JAR files which needs to be (re)packed. That means it can process all JAR files of your project with only one task execution in your build.xml

Ok, Let's start with an example build.xml file that shows how to use it (taken from Worldscape):

That's all - it will tell Apache that all files that have .jar as first extension are of the type "application/x-java-archive". And all files with the extension .gz have content-encoding of "gzip". But an extension .pack.gz has "pack200-gzip" as content encoding.
And the MultiViews options allows delegation of other files which are smaller and also satisfy the request made by the browser (Webstart in this case).

2. multithreading support (packing files in parallel on multi-core CPUs is much faster!)

Tom - Apache & Pack200 & JRE 1.4

Unregistered | 2010-10-20 12:08:53

Hi!
I know, that your blog is not the perfect place to discuss my problem. But I did not find an adequate blog, forum, etc. Maybe someone can point me to a more suitable "place". My Problem is as follows:
To speed up our applet based application we are using the "pack200" compression for the corresponding jar-files (e.g., First.jar, see example below). The applet is hosted on Apache 2. Unfortunately we have to support "old" JREs such as JRE 1.4.2. Therefore, as pack200 is not supportet in Java 1.4, the un-compressed "version" of the jar-file should be delivered if requested by a browser with Java plugin ver. 1.4.2.

I did not manage it to configure our Apache according to these requirements.

Using the following configuration always (both, for JRE 1.4 and for JRE 1.6) delivers the "unpacked" (uncompressed) jar (i.e., First.jar):

Thanks for the nice task. It is a lot better than the pack200 jar of Sun.

Is it possible to test if the jar is already repacked and don't repeat the operation? It would be a lot faster to repeat the operation. I'd be able to have my jars already packed and signed in the repository.

Tony Morris - pack200

Unregistered | 2010-06-09 04:00:22

You specify that there is a destfile attribute yet the source/jar have no such attribute. How does one specify the source and destination file to compress?

Frank

Unregistered | 2009-07-23 17:13:22

Very useful, and very well documented. Thanks.

Francis Lalonde - using p200ant with maven

Unregistered | 2008-06-30 21:15:22

oops, that pom.xml excerpt didnt go through very well. sorry for polluting the comments page. anyway, the trick to using p200ant with the antrun maven plugin is to install the jar file in the m2 repo, and then add a "dependency" section to the plugin definition block, referencing the p200ant jar.

David - Nice tool

Unregistered | 2008-04-29 02:25:00

Am using it in my every jar packaging. And the ant task is really helpful..good work!

kappa - Useful Stuff

Unregistered | 2008-04-14 02:01:12

Thanks for this most useful stuff.

Anonymous

Unregistered | 2007-10-30 21:35:27

nice :), tnx you save a lot of typing to my poor fingers

davidecr

Will Tatam

Unregistered | 2007-02-20 15:35:31

Any chance of including the ant build file in the source so we can easily rebuild ?

Todd

Unregistered | 2007-01-17 01:56:45

Matthias,

This is an extremely useful contribution to open source and I'd like to start by thanking you for it.

But I also have a request. It appears that the compiled jar was made with JDK 1.6 and that keeps it from being loaded properly in a 1.5 environment. I worked around the problem by simply recompiling the provided source. However, if you could supply the jar compiled with 1.5, that would be a nice benefit to others.
Thanks again.