Reducing the Download Time
Trail: Deployment
Lesson: Deployment In-Depth
Section: Deployment Best Practices

Reducing the Download Time

Rich Internet applications (RIAs) are downloaded from a web site when the user tries to access them. (RIAs can be cached after the initial download to improve performance). The time taken to download a RIA depends on the size of the RIA's JAR file. Larger JAR files take longer to download.

You can reduce the download time of your RIA by applying the following techniques:

The following steps describe how to create and deploy a compressed JAR file for a signed RIA.

  1. Normalize the JAR file using the --repack option.

    This step ensures that the security certificate and JAR file will pass verification checks when the RIA is launched.

    pack200 --repack DynamicTreeDemo.jar
  2. Sign the normalized JAR file.
    jarsigner -keystore myKeyStore DynamicTreeDemo.jar me
    where myKeyStore is the name of the keystore and me is the alias for the keystore.
  3. Pack the signed JAR file
    pack200 DynamicTreeDemo.jar.pack.gz DynamicTreeDemo.jar    
  4. Set the jnlp.packEnabled property to true in the RIA's JNLP file.
        <j2se version="1.6+"
                  max-heap-size="128m" />
        <jar href="DynamicTreeDemo.jar"
        <property name="jnlp.packEnabled"
        <!-- ... -->

When the jnlp.packEnabled property is set in the JNLP file, the Java Plug-in software looks for the compressed JAR file with the .pack.gz extension (for example, DynamicTreeDemo.jar.pack.gz). If found, the Java Plug-in software automatically unpacks and loads the JAR file. If a file with the .pack.gz extension is not found, then the Java Plug-in software attempts to load the regular JAR file (for example, DynamicTreeDemo.jar).

Note: You need to deploy your RIA on a web server to test the jnlp.packEnabled property.

Previous page: Deployment Best Practices
Next page: Avoiding Unnecessary Update Checks