Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Client applications > Deploy client applications > Deploy and running a Java EE client application > Download and running a Java EE client application using Java Web Start


Prepare the application client run time dependency component for Java Web Start

To launch a Java EE application client application, a Thin application client application, or both using Java Web Start (JWS), a Java Runtime Environment implementation JAR that IBM provides, the library JAR files and properties files bundled in Application Client for WAS must be installed in the JWS. Learn the steps to build the application client run time dependency component from an application client installation. It is packaged as a WAR file that can be installed in an application Server.

Install the Application Client for WAS for the operating system to which the client application deploys. If there is a requirement to deploy the client application to multiple operating systems, the application client run time dependency component must be built separately for each operating system that client application supports.

(Windows) For example, if the client application deploys to both the Windows operating system and Linux operating system, follows the steps for this task to build the application client run time dependency component for Windows operating systems, with the Application Client for WAS for Windows installed. Then, repeat the steps for this task to build the application client run time dependency component for Linux, on a Linux operating system, with the Application Client for WAS for Linux installed.


Procedure

  1. Install the Application Client for WAS for the client application supported operating systems.

    (Windows) Install the application client in the C:\Program Files\IBM\WebSphere\AppClient directory.

  2. Change the directory to the installation bin directory.

    (Windows) On Windows operating systems, the directory is as follows:

    CD C:\Program files\IBM\WebSphere\AppClient\bin
    
  3. Run the buildClientRuntime tool to generate the application client run time JAR file, which contains the Java Standard Edition Runtime Environment, the run time library JAR files, properties files, and the SSL KeyStore and TrustStore files from the application client installation.

    (Windows) For example, if you are using v7.0 and using the test certificate that is included in the application client installation:

    buildClientRuntime C:\WebApp1\runtime\WASClient7.0_windows.jar ..\etc\DummyClientKeyFilejar WebAS
    "websphere dummy client" JKS
    
  4. Run the buildClientLibJars tools to package up the properties files in the properties directory of the application client installation into a properties.jar file in the specified location. The buildClientLibJars tools will also copy the WebSphereClientLauncher.jar file and WebSphereClientRuntimeInstaller.jar file from the application client installation to the specified location. All jar files in the specified location will be signed by the provided certificate.

    For example, if you are using v7.0 and using the test certificate that is included in the application client installation:

    buildClientLibJars C:\Temp\webstart ..\etc\DummyClientKeyFilejar WebAS "websphere dummy client" JKS
    

  5. Create a JSP file or use a servlet to generate the application client run time installer Java Network Launching Protocol (JNLP) descriptor to respond to Java Web Start request. See the Java Web Start deployment sample in the application client installation.
  6. Package the two signed JAR files, WASClient7.0_windows.jar and WebSphereClientRuntimeInstaller.jar, and the JSP file or servlet for generating the Application Client run time installer JNLP descriptor into a web application archive (WAR) file. This WAR file is packaged into an EAR file that can be deployed to an application server. See the Java Web Start deployment sample in the application client installation.


Results

Your web application is ready to serve the application client run time and the JRE environment.


Example

<!-- This sample program applies to WAS, v6.1.
It is provided AS IS and may be used, executed, copied and modified
without royalty payment by customer (a) for its own instruction and study, (b) in order
to develop applications designed to run with an IBM WebSphere product, either for customer's
own internal use or for redistribution by customer, as part of such an application, in customer's own products.

Product 5630-A36,  (C) COPYRIGHT International Business Machines Corp., 2005
All Rights Reserved * Licensed Materials - Property of IBM -->

<%-- // to set the Last_Modified header so that the JNLP client will know whether to download
     // the JNLP file again and update the cached copy.
     String jspPath = application.getRealPath(request.getServletPath());
     java.io.File jspFile = new java.io.File(jspPath);
     long lastModified = jspFile.lastModified();
%>
<%
      // locally declared variables
      String url=request.getRequestURL().toString();
      String jnlpCodeBase=url.substring(0,url.lastIndexOf('/'));
      String jnlpRefURL=url.substring(url.lastIndexOf('/')+1,url.length());

      // Need to set a JNLP mime type - if WebStart is installed on the client,       // this header will induce the browser to drive the WebStart Client
      response.setContentType("application/x-java-jnlp-file");                            1
      response.setHeader("Cache-Control", null);
      response.setHeader("Set-Cookie", null);
      response.setHeader("Vary", null);
      response.setDateHeader("Last-Modified", lastModified);


     // An installer must reply with the version number for a given install
      if (response.containsHeader("x-java-jnlp-version-id"))
        response.setHeader("x-java-jnlp-version-id", "WASClient6.1.0");               2       else
        response.addHeader("x-java-jnlp-version-id", "WASClient6.1.0");
%>

<?xml version="1.0" encoding="utf-8"?>

<!-- ============================================================== -->
<!-- TODO: change "codebase" to the actual url location of this jsp -->
<!-- ============================================================== -->

<jnlp spec="1.0+"
codebase="http://YOUR_APP_SERVER:PORTNUMBER/WEBAPP_CONTEXT_ROOT/Runtime/WebSphereJre">

<information>
<title>Application Client Java Runtime Environment
</title>
<vendor>IBM
</vendor>
<icon href="icon.gif"/>
<description>Application Client Java Runtime Environment
</description>
<description kind="short">Application Client JRE
</description>
<description kind="tooltip">Application Client JRE
</description>
<offline-allowed/>
</information>

<security>
<all-permissions/>
</security>

<resources>
<j2se version="1.4+"/>
<%-- The installer can use any 1.4 JRE --%> 3

<jar href="WebSphereClientRuntimeInstaller.jar" main="true"/> 4


<!-- JRE version registration with Web Start -->
<property name="com.ibm.websphere.client.jre.version" value="WASClient6.1.0"/> 5

</resources>

<resources os="Windows"> 6

<!-- ============================================================== -->
<!-- TODO: the property value for unix platform is "java/jre/bin/javaw" -->
<!--   and the "os" value match to your target client machine platform
    -->
<!-- ============================================================== -->

<jar href="WASClient6.1.0_Windows.jar"/> 7


<!-- ============================================================== -->
<!-- TODO:  property value for unix platform is "java/jre/bin/javaw" -->
<!-- ============================================================== -->
<!-- relative path of the jre executable —->

<property name="com.ibm.websphere.client.jre.launch.java"
 value="java\jre\bin\javaw.exe"/> 8


</resources>
<installer-desc main-class="com.ibm.websphere.client.installer.ClientRuntimeInstaller"/>
</jnlp>

  1. Specifies that the file is a JNLP mime type so that the browser can process the JNLP file.
  2. Exact version of this Application Client run time dependency component in the response by setting the HTTP header field: x-java-jnlp-version-id.
  3. Required JRE version to run the installer program.

  4. Installer WebSphereClientRuntimeInstaller.jar file, which contains the ClientRuntimeInstaller class.
  5. System property that defines the version of Application Client run time dependency component. This version is registered to the JNLP client.
  6. Specifies resources for a particular platform. Each supported client application platform needs its own separate JAR file.
  7. Specifies the Application Client run time dependency component JAR file.
  8. Program to call that starts a JVM for the client application.


Related


buildClientRuntime tool
ClientRuntimeInstaller class
Web applications

+

Search Tips   |   Advanced Search