为 Java Web Start 准备应用程序客户机运行时依赖关系组件

要使用 Java™ Web Start (JWS) 启动 Java Platform, Enterprise Edition (Java EE) 应用程序客户机应用程序和/或瘦应用程序客户机应用程序,必须在 JWS 中安装 IBM® 提供的 Java 运行时环境实现 Java 归档 (JAR)、在 Application Client for WebSphere® Application Server 中绑定的库 JAR 文件和属性文件。您应该了解从应用程序客户机安装中构建与应用程序客户机运行时具有依赖关系的组件的步骤。它被打包成可安装在应用程序服务器中的 Web 应用程序归档 (WAR) 文件。

开始之前

为客户机应用程序部署至的操作系统安装 Application Client for WebSphere Application Server。如果需要将客户机应用程序部署到多个操作系统,那么必须为客户机应用程序所支持的每个操作系统分别构建与应用程序客户机运行时具有依赖关系的组件。

[Windows][Linux]例如,如果客户机应用程序将同时部署到 Windows 操作系统和 Linux 操作系统,请按照本任务的步骤为安装了 Application Client for WebSphere Application Server for Windows 的 Windows 操作系统构建与应用程序客户机运行时具有依赖关系的组件。然后,重复本任务的步骤,以便在安装了 Application Client for WebSphere Application Server for Linux 的 Linux 操作系统上为 Linux 构建与应用程序客户机运行时具有依赖关系的组件。

过程

  1. 根据客户机应用程序支持的操作系统,安装相应的 Application Client for WebSphere Application Server

    [Windows]将应用程序客户机安装到 C:\Program Files\IBM\WebSphere\AppClient 目录中。

  2. 将目录切换到安装 bin 目录。
    [Windows]在 Windows 操作系统上,目录如下所示:
    CD C:\Program files\IBM\WebSphere\AppClient\bin
  3. 运行 buildClientRuntime 工具 以生成应用程序客户机运行时 JAR 文件,此文件包含 Java 标准版运行时环境、运行时库 JAR 文件、属性文件以及 应用程序客户机安装中的 SSL 密钥库和信任库文件。
    [Windows]例如,如果您正在使用 V7.0,并且正在使用应用程序客户机安装中包括的测试证书:
    buildClientRuntime C:\WebApp1\runtime\WASClient7.0_windows.jar ..\etc\DummyClientKeyFilejar WebAS 
    "websphere dummy client" JKS
  4. 运行 buildClientLibJars 工具,以便将应用程序客户机安装的属性目录中的属性文件打包成指定位置中的 properties.jar 文件。 buildClientLibJars 工具还将 WebSphereClientLauncher.jar 文件和 WebSphereClientRuntimeInstaller.jar 文件从应用程序客户机安装复制到指定的位置。指定位置中的所有 JAR 文件都将由提供的证书签名。
    例如,如果您正在使用 V7.0,并且正在使用应用程序客户机安装中包括的测试证书:
    buildClientLibJars C:\Temp\webstart ..\etc\DummyClientKeyFilejar WebAS "websphere dummy client" JKS
  5. 创建 JavaServer Pages (JSP) 文件或者使用 Servlet 来生成应用程序客户机运行时安装程序 Java 网络启动协议 (JNLP) 描述符,以响应 Java Web Start 请求。请参阅应用程序客户机安装中的“Java Web Start 部署样本。
  6. 将两个已签名的 JAR 文件 WASClient7.0_windows.jarWebSphereClientRuntimeInstaller.jar 以及用于生成应用程序客户机运行时安装程序 JNLP 描述符的 JSP 文件或 Servlet 打包成 Web 应用程序归档 (WAR) 文件。这个 WAR 文件将打包成可以部署到应用程序服务器的 EAR 文件。请参阅应用程序客户机安装中的“Java Web Start 部署样本。

结果

您的 Web 应用程序已准备好为应用程序客户机运行时和 JRE 环境提供服务。

示例

<!-- This sample program applies to WebSphere Application Server, Version 6.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. 指定该文件是 JNLP mime 类型以便浏览器可以处理 JNLP 文件。
  2. 通过设置 HTTP 头字段 x-java-jnlp-version-id 来在响应中指定与该应用程序客户机运行时具有依赖关系的组件的确切版本。
  3. 指定需要的 JRE 版本以运行安装程序。
  4. 指定安装程序 WebSphereClientRuntimeInstaller.jar 文件,它包含 ClientRuntimeInstaller 类。
  5. 指定系统属性,此属性定义与应用程序客户机运行时具有依赖关系的组件版本。此版本注册到 JNLP 客户机。
  6. 为特定的平台指定资源。每个受支持的客户机应用程序平台需要自己独立的 JAR 文件。
  7. 指定与应用程序客户机运行时具有依赖关系的组件 JAR 文件。
  8. 指定要调用的程序,该程序为客户机应用程序启动 JVM。

指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tcli_jrerun
文件名:tcli_jrerun.html