布署Java Web Start

 

  • 在布署Java Web Start前先确认Web Server支持JNLP文件类型。添加.jnlp扩展名的确认,可以通过添加MIME类型为“application/x-java-jnlp-file”进行设置。
  • 创建JNLP文件
    1. 运行Java Web Start的关键是Java Network Launching Protocol,即JNLP文件。 JNLP是一个包含Java Web Start运行属性的XML文件。
    2. 例:
      1. <?xml version="1.0" encoding="utf-8"?>
      2. <!-- JNLP File for Notepad -->
      3. <jnlp spec="1.0+"
      4.       codebase="http://java.sun.com/docs/books/tutorialJWS/deployment/webstart/examples/" 
      5.       href="Notepad.jnlp">
      6.    <information>
      7.       <title>Notepad Demo</title>
      8.       <vendor>The Java(tm) Tutorial: Sun Microsystems, Inc.</vendor>
      9.       <description>Notepad Demo</description>
      10.       <homepage href="http://java.sun.com/docs/books/tutorial/deployment/webstart/running.html"/>
      11.       <description kind="short">ClickMeApp uses 3 custom classes plus several
      12.        standard ones</description>
      13.       <offline-allowed/>
      14.    </information>
      15.    <resources>     
      16.     <jar href="Notepad.jar"/>   
      17.     <j2se version="1.6+"
      18.           href="http://java.sun.com/products/autodl/j2se"/>
      19.    </resources>
      20.    <application-desc main-class="Notepad"/>
      21. </jnlp>
  • 放置应用程序到Web Server
    1. 放置应用程序的所有Jar文件及JNLP文件到Web Server, 必需确保Jar文件是放置到JNLP文件jar单元的href属性指定的位置当中。
  • 创建Web Page
    1. 创建一个页面用于用户访问你的应用程序,其中只是一个简单的链接,但是同时应该添加用于安装Java Web Start的链接。    
    2. 添加一个引用JNLP文件的链接,例如:<a href="Notepad.jnlp">Launch Notepad Application</a>
    3. 添加用于安装Java Web Start的链接。参考:Java Web Start Guide
  • 原文地址:https://www.cnblogs.com/huhu0013/p/2670229.html