Java Reference
In-Depth Information
The fragment of the JNLP file in Listing 9.2 gives the following information to the JNLP
• The JNLP file being processed is an application descriptor.
• The program execution starts by executing the main(..) method of the MyMainClass
class in the main JAR file. The main JAR file is a specially defined JAR in the JNLP file
intended to contain the main() method for the application.
• The parameters for the main() method are the <argument> values, in the same order as
in the JNLP file. So Listing 9.2 causes the JNLP Client to execute the following:
{ “CommandLineArg1”,”CommandLineArg1”,”CommandLineArg1” }
We saw some application descriptor JNLP files in Chapter 8, and we will see many more in the
following chapters.
Now, let's see something interesting. Many programmers approaching JNLP technology often
confuse the role of the installer and that of the application. In the JNLP terminology, these
words refer only to the JNLP Client and how it has to treat the specified Java executables.
When we specify a JNLP file (and all its resource elements) as an installer descriptor, it will
only be executed the first time that code is launched, in order to prepare the environment for
the application described in the application descriptor JNLP file. Then what the launched
application does, is beyond the scope of the JNLP Client that finishes its job launching the
application and supporting it with runtime services.
As an example of that, let's examine a Java class that is treated like a normal application by the
JNLP Client, but once launched, it launches a native executable. In other words, it works much
like an installer itself.
Retrieving and Executing a Native Installer
An interesting case that happens often in real situations is to execute a native installer. Often, it
is the quickest way to deploy our legacy code (we used to deploy our applications to our cus-
tomers with a big setup.exe file), or we can have some code that needs special native support
each time the application is launched.
Naturally, this example can be adapted to also launch any kind of native files.
Let's examine the JNLP file shown in Listing 9.3.
Search WWH ::

Custom Search