Java Reference
In-Depth Information
The configuration file that must be created uses Java Network Launching Protocol
(JNLP), an Extensible Markup Language (XML) file format that specifies the applica-
tion's main class file, its JAR archive, and other things about the program.
NOTE
XML is introduced during Day 20, “XML Web Services.” Because
the format of JNLP files is relatively self-explanatory, you don't
need to know much about XML to create a JNLP file.
The next project you will undertake is to use Java Web Start to launch and run PageData,
an application that displays information about web pages. The application requires the
PageData.class file, which can be downloaded from the Day 14 page of the topic's
website at http://www.java21days.com. (You also might want PageData.java in case you
decide to make any changes to the application.)
To get ready, put a copy of that project's class file in the folder you are using as a work-
space for your Java programming.
Creating a JNLP File
The first thing you must do is package all of an application's class files into a Java
archive file along with any other files it needs. If you are using the JDK, you can create
the JAR file with the following command:
jar -cf PageData.jar PageData.class
A JAR file called PageData.jar is created that holds the class file.
Next, you should create an icon graphic for the application, which will be displayed
when it is loaded and used as its icon in menus and desktops. The icon can be in either
GIF or JPEG format and should be 64 pixels wide by 64 pixels tall.
For this project, if you don't want to create a new icon, you can download
pagedataicon.gif from the topic's website. Go to http://www.java21days.com and open
the Day 14 page. Right-click the pagedataicon.gif link and save the file to the same
folder as your PageData.jar file.
The final thing you must do is create the JNLP file that describes the application. Listing
14.1 contains a JNLP file used to distribute the PageData application. Open your word
processor and enter the text of this listing; then save the file as PageData.jnlp .
Search WWH ::




Custom Search