随笔-1  评论-68  文章-98  trackbacks-0
Java 网络加载协议 (JNLP): 是 Java Web Start 的一个组成协议,通常定义为一种通过网络并穿透防火墙传输驻留于服务器的应用程序、并在客户机上启动它的机制。

Java(TM) Web Start:是一种简化 Java 应用程序部署的技术,让用户不需要复杂的安装过程,单击 Web 浏览器就可以启动全功能的应用程序。J2SE 捆绑了 Java Web Start。

D/S结构(Destktop Application/Server Application):客户端使用Swing,服务器端使用Servlet,采用Swing 和 Servlet来交换数据,可以采用标准的HTTP协议来通讯,来交换数据。

JNLP 文件其实是一个xml文件,描述了产品信息,使用的jar文件网址和 main-class 定义等。
客户端点击 JNLP 文件的连接,就会激活本地的 Java Web Start,选择下载 jar 包后,下载完备就可以运行相关的程序。可以操作本地数据,其实是把 jar 包下载到本地(每次允许都会自动更新),调用远程的 servlet 来交互数据。

样例 JClaim 的jclaimsf.jnlp 代码清单:

<?xml version="1.0" encoding="utf-8"?> 
<!--
  ~ Copyright (c) 2006, ITBS LLC. All Rights Reserved.
  ~
  ~     This file is part of JClaim.
  ~
  ~     JClaim is free software; you can redistribute it and/or modify
  ~     it under the terms of the GNU General Public License as published by
  ~     the Free Software Foundation; version 2 of the License.
  ~
  ~     JClaim is distributed in the hope that it will be useful,
  ~     but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~     GNU General Public License for more details.
  ~
  ~     You should have received a copy of the GNU General Public License
  ~     along with JClaim; if not, find it at gnu.org or write to the Free Software
  ~     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  ~
  
-->

<jnlp
  
spec="1.0+" 
  codebase
="http://jclaim.sourceforge.net"
  href
="/jclaimsf.jnlp"
  
>
  
<information> 
    
<title>JCLAIM</title> 
    
<vendor>ITBS LLC</vendor> 
    
<description>Java Compliant Logging and Auditing Instant Messenger.</description> 
    
<description kind="short">JCLAIM</description> 
    
<icon href="/logo.gif"/>
  
</information> 
  
<security> 
    
<all-permissions/> 
  
</security> 
  
<resources>     
    
<j2se version="1.5" max-heap-size="25m"/>
    
<jar href="jclaim.jar" main="true"/>  
    
<jar href="cos.jar" />  
    
<jar href="jaimlib.jar" />  
    
<jar href="jazzy.jar" />  
    
<jar href="jdic.jar" />  
    
<jar href="joscar.jar" />  
    
<jar href="jsocks.jar" />  
    
<jar href="msnm.jar" />  
    
<jar href="oscar.jar" />  
    
<jar href="smack.jar" />  
    
<jar href="ymsg.jar" />  
  
</resources> 
  
<resources os="Mac">
     
<jar         href="lib/mac/jdic_misc.jar"/> 
  
</resources>
  
<resources os="Windows">
     
<jar         href="lib/win32/jdic_misc.jar"/> 
     
<jar         href="lib/win32/jdic_stub.jar"/> 
     
<nativelib   href="lib/win32/native.jar"/>
   
</resources>
   
<resources os="Linux">
       
<jar       href="lib/linux/jdic_stub.jar"/> 
     
<nativelib   href="lib/linux/native.jar"/>
   
</resources>
   
<resources os="SunOS" arch="x86">
      
<jar        href="lib/sunos/jdic_stub.jar"/> 
     
<nativelib   href="lib/sunos/native.jar"/>
   
</resources>
   
<resources os="SunOS" arch="sparc">
      
<jar        href="lib/sunos/jdic_stub.jar"/> 
     
<nativelib   href="lib/sunos/native.jar"/>
   
</resources>

  
<application-desc main-class="com.itbs.aimcer.gui.Main">   
  
</application-desc>
</jnlp> 

资源:

Java Web Start http://java.sun.com/products/javawebstart/developers.html
动态 JNLP https://www6.software.ibm.com/developerworks/cn/education/java/j-dynjnlp/tutorial/j-dynjnlp-1-1.html
posted on 2006-03-09 01:15 Xu Jianxiang 阅读(2504) 评论(1)  编辑  收藏 所属分类: Java Tech

评论:
# re: Java 网络加载协议 (JNLP) 2007-03-29 14:21 | jaly
这句是不是有些问题:<nativelib href="lib/win32/native.jar"/>
在JDIC官方网上有这么一句话:
NOTE: the native jar file name must be jdic-native.jar. Since the application needs to retrieve the native files after the jar file is unjar'ed by Java Web Start.

请楼主再测试一下。  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: