Trail: Deployment
Lesson: Java Web Start
The JNLP API
The JNLP API
The Java platform includes the JNLP API to enable you to provide additional information to applications deployed through Java Web Start.

The JNLP API is included in the javax.jnlp package, which is delivered in the jnlp.jar as part of te Java Development Kit version 6, in the sample/jnlp/servlet directory. The javax.jnlp package is also delivered in the javaws.jar, which is located in the JRE's lib directory.

The following table provides an overview of the main interfaces and classes in the javax.jnlp package. For more information, see the API documentation and the Java Web Start Guide .


Warning : Java Web Start warns users of the following Interfaces and Classes about the potential security risk of allowing an untrusted application to access the file system, use the system printer, use the system clipboard, or increase the disk space used by the PersistenceService.
Interfaces and Classes in the javax.jnlp Package
Interface or Class Description
BasicService Provides methods for:
  • Determining the codebase of the application
  • Determining whether the application is online or not
  • Determining whether a Web browser is supported on the current platform and by the JNLP client.
  • Opening a specific URL in the browser
ClipboardService Provides methods for copying contents to and from the client system's clipboard. The ClipboardService interface works for applications running in a sandbox.
DownloadService Provides the ability to control how the application's resources are cached.
ExtendedService Provides additional support to the current JNLP API. It allows applications to open specific file(s) in the client's file system.
FileContents Encapsulates the name and contents of a file. An object of this class is used by the FileOpenService, FileSaveService and PersistenceService interfaces.
FileOpenService Provides the ability for applications to open files on the local file system.
FileSaveService Provides methods for exporting files to the local disk, even for applications that are running in the restricted execution environment.

Note: This interface provides the same level of disk access to potentially untrusted Web-deployed applications that a Web browser provides for content it displays through its Save As . . . dialog box.

JNLPRandomAccessFile Supports reading from and writing to a random access file. A random access file behaves like a large array of bytes stored in the file system.
PersistenceService Provides methods for storing data locally on the client system, even for applications that are running in a sandbox.

Note: This service is similar to the cookie mechanism for HTML-based applications. Cookies allow a small amount of data to be stored locally on the client system. That data can be securely managed by the browser and can only be retrieved by HTML pages which originate from the same URL as the page that stored the data.

PrintService Provides methods for access to printing, even for applications that are running in the restricted execution environment.

Note: Starting with Java Web Start 5.0, you can use the Java Printing APIs, so there is no need to use this interface. If the application is running in a sandbox, Java Web Start opens a security dialog box asking the user for permission to print.

SingleInstanceService Provides a set of methods for applications to register themselves as singletons, and to register listener(s) for handling arguments passed in from different instances of applications.
Previous page: Developing Java Web Start Applications
Next page: Java Web Start and Security