2011年8月22日 星期一

Java Web Start and JNLP

JWS介紹請看 WIKI
http://en.wikipedia.org/wiki/Java_Web_Start


An example JNLP file

Example 1

The JNLP file obtains and locates files in a manner similar to a Web browser, using only URLs and not specific file names. Listing 2 shows an example JNLP file.




<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="http://www.companySite.com/javaApp">
<href="clientapp.jnlp">
<information>

<vendor>Company name</vendor>
<icon href="companyLogo.gif">
<homepage ref="reference/tips.html">
<offline-allowed>
</information>
<resources>
<j2se version="1.3/">
<jar href="companySong.jar" part="music" download="lazy">
</resources>
<resources os="Windows">
<nativelib="windowiconsforwindowos.jar" part="windowIcons" download="eager">
<application-desc class="com.company.ui.Client">
<security>
<all-permissions>
</security>
</jnlp>




Example 2


<xml version="1.0" encoding="UTF-8">
<jnlp codebase="http://localhost/webstart/" href="piao.jnlp" spec="1.0+">
<information>

<vendor>piao無所不在</vendor>
<homepage href="http://localhost">
<icon href="piao.jpg">
<description>web start test</description>
</information>
<offline-allowed>

<security>
<all-permissions>
</security>
<resources>
<j2se version="1.4+">
<jar href="flowsheet.jar">
</resources>
<application-desc class="piao.fs.test.Main">
</APPLICATION-DESC>
</jnlp>


web server 的 mime type mapping 裡也記得要加入 .jnlp file mapping。

<mime-mapping>
<extension>jnlp</extension>
<mime-type>application/x-java-jnlp-file</MIME-TYPE>
</mime-mapping>



Reference:
http://www.ibm.com/developerworks/java/library/j-webstart/
http://www.mkyong.com/java/java-web-start-jnlp-tutorial-unofficial-guide/
http://www.javaworld.com.tw/roller/piaoyi/entry/java_web_start_and_jnlp



沒有留言:

張貼留言