Java Web Start


In computing, Java Web Start is a framework developed by Sun Microsystems that allows users to start application software for the Java Platform directly from the Internet using a web browser. Some key benefits of this technology include seamless version updating for globally distributed applications and greater control of memory allocation to the Java virtual machine.
Java Web Start was distributed as part of the Java Platform, and included in downloads of the JRE and JDK. It was deprecated by Oracle in Java SE 9 and removed in Java SE 11. The code for Java Web Start was not released by Oracle as part of OpenJDK, and thus OpenJDK originally did not support it. IcedTea-Web provides an independent open source implementation of Java Web Start that is currently developed by the AdoptOpenJDK community, RedHat and Karakun AG, and which is bundled in the official OpenJDK installer. Next to this provides an open source based implementation that is based on IcedTea-Web but offers more features and commercial support options.

Functionality

Unlike Java applets, Web Start applications do not run inside the browser. By default they run in the same sandbox as applets, with several minor extensions like allowing to load and save the file that is explicitly selected by the user through the file selection dialog. Only signed applications can be configured to have additional permissions.
Web Start has an advantage over applets in that it overcomes many compatibility problems with browsers' Java plugins and different JVM versions. Web Start programs are no longer an integrated part of the web page, they are independent applications that run in a separate frame.
Web Start can also launch unmodified applets that are packaged inside.jar files, by writing the appropriate JNLP file. This file can also pass the applet parameters. Such applets also run in a separate frame. Applet launcher may not support some specific cases like loading class as resource.
Like applets, Java Web Start is cross-platform.

Deprecation

As of JDK9, Java applets are deprecated by Oracle with Java Web Start being the intended replacement.
In March 2018, Oracle announced it will not include Java Web Start in Java SE 11 and later. Developers will need to transition to other deployment technologies.

Implementation

The developer prepares a special XML file with JNLP extension. This file describes the application requirements, code location, parameters and additional permissions. The browser downloads this file as any other and opens it with Web Start tool. Web Start tool downloads all necessary resources and launches the application.
Java Web Start provides a series of classes in the javax.jnlp package which provide various services to the application. Sun designed most of these services with the aim of allowing carefully controlled access to resources while restricting the application to authorized operations.
Sun introduced version 1.0 of Web Start in March 2001, while 64-bit Windows support was added only in Java 6. Since J2SE 1.4 Web Start comes as a default part of Java Runtime Environment called javaws, computer administrators no longer have to install it separately.

Java Network Launching Protocol (JNLP)

Programmers often speak of the Java Network Launching Protocol interchangeably with the term "Web Start". The JNLP protocol, defined with an XML schema, specifies how to launch Java Web Start applications. JNLP consists of a set of rules defining how exactly to implement the launching mechanism. JNLP files include information such as the location of the jar package file and the name of the main class for the application, in addition to any other parameters for the program. A properly configured browser passes JNLP files to a Java Runtime Environment which in turn downloads the application onto the user's machine and starts executing it. The development of JNLP took place under the Java Community Process as JSR 56.
Important Web Start features include the ability to automatically download and install a JRE in the case where the user does not have Java installed, and for programmers to specify which JRE version a given program needs in order to execute. The user does not have to remain connected to the Internet to execute the downloaded programs, because they execute from a locally maintained cache. Updates of the software download from the Web and become available when the user has a connection to the Internet, thus easing the burden of deployment.
Any computer user can use JNLP simply by installing a JNLP client. The installation can occur automatically such that the end-user sees the client launcher downloading and installing the Java application when first executed.
JNLP works in a similar fashion to how HTTP/HTML works for the web. For rendering an HTML webpage, after the user clicks on a weblink, the browser submits a URL to a webserver, which replies with an HTML file. The browser then requests the resources referred to by this file, and finally renders the page once it has received enough information. Page rendering usually starts before all resources have downloaded; some resources not critical to the layout of the page can follow on afterwards.
JNLP mirrors this process; in the same way that a Web browser renders a webpage, a JNLP client "renders" a Java app. After the user clicks on a weblink, the browser submits an URL to a webserver, which replies with a JNLP file for the application. The JNLP client parses this file, requests the resources specified, waits for the retrieval of all required resources, and then launches the application. The JNLP file can list resources as "lazy", which informs the JNLP client that the application does not need those resources to start, but can retrieve them later on when/if the application requests them.

Example

The example below gives a simple JNLP file to launch the applet, specifying code base, source, main class and window size. Such file contains all necessary references and is self-sufficient to launch the application. As no permissions are requested, the code will run in a sandbox. JNLP also states that this application can run offline and should be updated as a background process.




Launch applet with Web Start
Foo Bar Inc.










Pack200 compression

To reduce the size of a Java Web Start application Sun Microsystems introduced a compression system called Pack200 in Java 1.5.0. It can compress a large jar file to one-ninth of its original size if it contains only Java classes.
Java Web Start has supported Pack200 since it first appeared, but initially this feature required server-side cooperation and a certain amount of expertise to set up. When Sun introduced Java SE 6u10, Pack200 support became available without the need for special server support. Application designers can enable or disable this feature within JNLP files.
On slow connections Pack200 gives a performance boost in application startup time and download time.

Signed Web Start applications

By default, Java Web Start applications run "restricted", which means that they do not have access to some system resources such as local files. But publishers can remove these restrictions by signing their Web Start applications with the jarsigner tool that comes with the JDK.

Alternatives

The open-source IcedTea project provides an alternative JNLP implementation in IcedTea-Web. As of version 1.7.2, it also works on newer versions without official JWS support.
To run Java Web Start-based application after the release of Java 11, the company Karakun AG has released the open source tool OpenWebStart, based on IcedTea-Web. The tool includes all the functionality of IcedTea-Web and adds extended features, such as native installers for Mac OS, Windows, and Linux. IcedTea-Web was created with support from RedHat and AdoptOpenJDK.
Webswing is a specialized web server for running Swing based Java applications in a browser.

Notable applications