Java Reference
In-Depth Information
The
main-class
attribute identifies the name of the class file, which is specified without
the
.class
file extension.
If the class should be run with one or more arguments, place
argument
elements within
an opening
<application-desc>
tag and a closing
</application-desc>
tag.
The following XML specifies that the
PageData
class should be run with two arguments:
http://java.sun.com
and
yes
:
<application-desc main-class=”PageData”>
<argument>http://java.sun.com</argument>
<argument>yes</argument>
</application-desc>
After you have created the
PageData.jnlp
file, change line 5 of Listing 14.1 so that it
refers to the folder on a web server where your application's JAR file, icon file, and
JNLP file will be stored.
Upload all three of the project's files to this folder; then run your browser and load the
JNLP file using its full web address. If your web server is configured to support Java
Web Start, the application will be loaded and begin running, as in Figure 14.4.
FIGURE 14.4
Running PageData
using Java Web
Start.
For this application to be run without restriction, the
PageData.jar
file must be digitally
signed. For real-world applications, this requires the services of a certificate-granting
authority such as Thawte or VeriSign and can cost $1,000 or more per year.