Deploying JAR Files Compressed with Pack200

Java Rich Internet Applications Guide > Networking > Deploying JAR Files Compressed with Pack200

When the Java system property jnlp.packEnabled is set to true in a JNLP file or an applet tag, Java Plug-in or Java Web Start will download the JAR file compressed by the Pack200 tool. If the this compressed version is not available, Java Plug-in or Java Web Start will look for the uncompressed version.

Note: Pack200 compressed JAR files must have the extension pack.gz. For example, if your JAR file is named foo.jar, then the Pack200 compressed version of this file must be named foo.jar.pack.gz.

Usage in a JNLP File

Use the property tag to specify jnlp.packEnabled to true within the resources tags, for example:

<jnlp ...>
   ...
   <resources>
      <property name="jnlp.packEnabled" value="true"/>
         <java version="1.5+" href="http://javadl.sun.com/webapps/jawsautodl/AutoDL/j2se"/>
         <jar href="foo.jar" main="true" download="eager"/>        
   </resources>
   ...
</jnlp>

In this example, Java Web Start and the Java Plug-in first look for foo.jar.pack.gz. If the file is not found, they look for the original, foo.jar.

Usage in Applet Tag

Pass the -Djnlp.packEnabled VM argument by using java_arguments, for example:

<HTML>
   ...
   <APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25>
      <PARAM NAME  = "cache_archive" VALUE = "HelloWorld.jar"/>
      <PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true"/>
   </APPLET>
   ...
</HTML>

The Java Plug-in looks for HelloWorld.jar.pack.gz; if this file is not available, it looks for HelloWorld.jar.

Related Links


Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.