Java Reference
In-Depth Information
The method extractNativeResource() extracts a resource with the given name from the
loaded JAR files (installed by the JNLP Client, specified in the install-win JNLP file in
Listing 9.3) locally.
The method executeNativeResource() simply executes the file passed as the argument while
the method deleteTempFile() removes the temp file.
Resources are loaded via the currently installed classloader, obtained at line 20. We will see all
this in detail in Chapter 11.
N OTE
This code is intended only as an example of the use of JNLP technology, to be
adapted to real cases as needed.
When executing the install-win JNLP file with Java Web Start, we are asked for permission
to run it, as shown in Figure 9.4.
9
F IGURE 9.4
Java Web Start warns the user before executing intrusive code.
Given the low level of trustworthiness of our certificate (home-made only for testing, as
described in Chapter 10), Java Web Start is rather suspicious but leaves the final decision to the
user (security issues and the underlying philosophy are discussed in the next chapter). After
having allowed the execution, we obtain the output in Listing 9.6.
L ISTING 9.6
The Java Web Start Log File After the Execution
Java Web Start Console, started Mon Apr 16 11:23:49 GMT+02:00 2001
Java 2 Runtime Environment: Version 1.3.0 by Sun Microsystems Inc.
Logging to file: D:\Documents\myprojects\log.txt
temp file deleted.
installation terminated.
Search WWH ::




Custom Search