Java Web StartでJavaアプリケーションを配布するには、 JNLP(Java Network Launching Protocol)ファイルを用意する必要があります。
Windows用に提供されているJava2には、「Java™ Web Start 1.2」 が同梱されています。 ただ、MacOS X 10.1以降に含まれているJava™ Web Startのバージョンは、1.0.1 と少々古めです。
Java™ Web Startのバージョンの違いにより、 Windows用に作成したJNLPファイルがそのままでは動きませんでした。 そこで、違いを書いておきます。
一番悩んだのは、Java™ Web Start 1.2でちゃんと動いていたJNLPファイルが、 Java™ Web Start 1.0.1では何も表示されないことでした。 これは、文字コード「UTF-8」しか対応していなかったことによることが原因です。
| UTF-8 is a specific way of representing Unicode characters. It preserves the ASCII encoding, and grows to be as wide as 6 bytes, based upon the specific character. With Java Web Start 1.0, it was the only encoding that was supported . |
[引用元]
Deploying Software with JNLP and JavaTM Web Start
Moving on to Java Web Start 1.2
URLは、以下の通り。
http://java.sun.com/features/2002/10/webstart.html
後、注意しなければならないのが、以下の点です。
TextViewerの配布を行うJNLPファイルをサンプルとしてご紹介します。
<?xml version="1.0" encoding="UTF-8"?>
<!--
Java Web StartでTextViewerを配布する
by naoya ando
(C) 2003/1/24 MacOS X 12.2.3 and J2SDK 1.3 Version
(C) 2002/6/14 Windows XP and J2SDK 1.4 Version
-->
<jnlp spec="1.0+" codebase="http://homepage2.nifty.com/ann/WebStart/"
href="TextViewer.jnlp">
<information>
<title>TextViewer</title>
<vendor>Naoya Ando</vendor>
<homepage href="http://homepage2.nifty.com/ann/WebStart/" />
<icon href="TextViewer.gif"/>
<description>Read Textfile and View.</description>
<offline-allowed />
</information>
<resources>
<j2se version="1.3+" />
<jar href="TextViewer.jar" />
</resources>
<application-desc main-class="TextViewer" />
<security>
<all-permissions/>
</security>
</jnlp>
以下のURLからアクセスできます。
http://homepage2.nifty.com/ann/WebStart/TextViewer.jnlp
JNLPについて、詳しくは「JNLP Specification Guide」をご覧ください。
http://java.sun.com/products/javawebstart/download-spec.html