Spec-Zone .ru
спецификации, руководства, описания, API

Java

Pack200 and Version Download
for JavaSE 6u10

Documentation Contents

Java Web App Development and Deployment > Java Web App Deployment Advice > Pack200 and Version Download

Contents

Related Links


Introduction

Prior to JavaTM SE 6 Update 10, engineers had to deploy the JNLPDownloadServlet on the web servers in order to use Pack200 or download specific versions of their application JARs. While this solution works, it limits the flexibility of deploying versioned or Pack200 compressed JARs: Engineers might not have access to deploy JNLPDownloadServlet on web servers.

Java SE 6 u 10 introduces two new Java system properties to enable Pack200 and version download - jnlp.packEnabled and jnlp.versionEnabled.

Pack200

When the Java system property jnlp.packEnabled is set to "true" in a jnlp file or an applet tag, Java Web App (Java Web Start or Applet) will download the .pack.gz version of JARs. If the .pack.gz version is not available, the unzipped JAR will be searched for.

Note: the compressed version of foo.jar should 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, i.e.:

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

In the above case, Java Web Start and the new Java Plug-In will first look for foo.jar.pack.gz. If the file is not found, they will fall back and look for the original, foo.jar.

Usage in Applet Tag

Pass the "-Djnlp.packEnabled" VM argument by using "java_arguments", i.e.:

<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>

This feature is only available to New Java Plug-In since it requires passing the VM argument to Java VM. The New Java Plug-In will look for HelloWorld.jar.pack.gz, if this file is not available, it will fall back and look for HelloWorld.jar.

Version Download

Version download is the ability to request that specific versions of certain jar files be used by applets and Java Web Start applications. The jnlp.versionEnabled applies to Java Web Start applications and applets deployed using JNLP.

Usage in a JNLP file

When the Java system property jnlp.versionEnabled is set to "true" in the jnlp file, if the JAR version is specified, the server is checked for the versioned JAR file using the naming convention:

  <file> ::= <name> "__" <options> ".jar"
  <options> ::= "V" <version-id>

Note: version 1.0 of foo.jar should be named foo__V1.0.jar.

The original jar will be used if the versioned jar file is not found. .

 


Copyright ©2008 Sun Microsystems, Inc. All Rights Reserved.
Feedback

Sun
Java Technology