Java Web Start is a new standard for distributing Java applications, based on a blend between applet advantages (delivered and automatically updated via the Web) and standalone applications (without any dependencies on a web browser). The documentation, several demonstrations, and implementations for Windows and Solaris users are available for download from http://java.sun.com/products/javawebstart/. Fortunately for Mac OS X users, an implementation of Java Web Start is included in every distribution of Mac OS X (specifically, Java Network Launching Protocol & API (JNLP) Specification, v1.0.1). There's nothing to configure and nothing to set up?it's just there, waiting for you to take advantage of it!
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.
- On Mac OS, Oracle E-Business Suite always uses the Java Plug-in instead of Java Web Start for launching the Forms application and Java applets. It automatically falls back to the Java Plug-in, even if the environment (at the site level) is configured for Java Web Start. When selecting a java based form in.
- One way Java apps are distributed is called Java Web Start (see here for more information on this technology). These are small files that are downloaded and executed, as opposed to embedded code within a webpage.
As shown in Figure 8-7, users will typically first encounter a Web Start application while browsing the Web. Clicking on a link to a Web Start JNLP file causes the browser to launch a helper application, which in turn downloads the resources for the Java application and then launches it. From that point on, users can launch a Web Start application without launching a web browser. In addition, if the application is properly designed and makes sense, Web Start applications can be launched independently of a network connection.
Figure 8-7. Web Start deliveryConsider, for example, a Tic-Tac-Toe game in which the user plays against the computer or a remote opponent. A user surfing the Web with a laptop clicks a link to a JNLP file to launch the game. The browser downloads the JNLP file, which is then launched by Web Start. Web Start downloads the game resources, saves them in a cache, and then launches the application. The user can play the game against remote opponents and the computer, quitting the browser if desired. Later, the user disconnects the laptop from the network and gets on a plane. The user can still launch the game by using the Java Web Start utility (located in /Applications/Utilities/Java/), even without a network connection. The user can only play against the computer, however, as no network connection is available.
At the heart of Web Start is the JNLP file (essentially, an XML configuration file that describes the application and application resources). This section will turn the previously developed SimpleEdit application into a Web Start-packaged application.
Before starting, it's worth spending some time looking at the Web Start management application stored in /Applications/Utilities/Java (shown in Figure 8-8). This is the only real user interface to Web Start beyond whatever interface you present as part of your application.
Figure 8-8. The WebStart user interfaceBy default, users who launch a Java Web Start application more than twice are prompted to save the application as a standard Mac OS X application, as shown in Figure 8-9. This is a standard Web Start behavior, designed to encourage use of Web Start applications outside the confines of the browser. The application is still a Java Web Start application, but now users can work with the application like other Mac OS X applications (for example, by adding its icon to the Dock).
Figure 8-9. Java Web Start desktop integrationNote that even though users won't have to launch a web browser every time a Web Start application is launched, Web Start checks the network connection and attempts to download any updates. If an update is available, Web Start automatically downloads and installs the latest version of the application before launching.
|
8.2.1 Web Start Runtime Environment
When building JNLP-based applications, consider the restrictions on the environment and the packaging. From Sun's Web Start documentation (at http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html#dev), the following list details the required attributes of JNLP-delivered applications:
An application must be delivered as a set of JAR files.
All application resources, such as files and images, must be stored in JAR files, and they must be referred to by using the getResource( ) mechanism in the Java 2 platform (see Section 8.2.3 below).
An application is allowed to use the System.exit( ) call.
An application that needs unrestricted access to the system must be delivered in a set of signed JAR files. All entries in each JAR file must be signed.
If an application is written to run in a secure sandbox, it must follow these additional restrictions:
No access to local disk is available.
All JAR files must be downloaded from the same host.
Network connections are enabled only to the host from which the JAR files are downloaded.
No security manager can be installed.
No native libraries can be installed or utilized.
Limited access is provided to system properties. The application has read/write access to all system properties defined in the JNLP file, as well as read-only access to the same set of properties that an applet has access to.
8.2.2 Mac OS X Web Start Differences
You need to be aware of only a few differences between the Mac OS X implementation of Java Web Start and that of the Windows and Solaris versions. First, Mac OS X does not support dynamic downloading of additional Java Runtime Environments (JREs). Mac OS X includes J2SE 1.4 (and 1.3.1 is easily available), so if your application specifically requires JRE 1.2 or prior, it will not work. Users who need the latest JVM should use their standard Mac OS X Software Update functionality (available in System Preferences) to download Apple JDK releases. Specifications for version numbers that can expand to include 1.4 will work, though (for example, 1.2+ or 1.3+). It also isn't necessary to set up proxy information explicitly in the Web Start application on Mac OS X?this is automatically configured via the Network control panel proxy settings.
8.2.3 JAR Resources
Frogger machine. Java Web Start maintains strict control over the class loading configuration. It transfers JAR files from the web server to the client machine, and chooses where to store the JAR files; an application cannot use disk-relative references to resources such as images and configuration files.
Therefore, application resources should be retrieved from the JAR files specified in the resources section of the JNLP file, or retrieved explicitly by an HTTP request to the web server. It's easiest to store resources directly in the JAR files, since they will be cached on the local machine by Java Web Start (preventing a potentially expensive or even unreachable network connection).
The code example shown in Example 8-3 shows how to retrieve images from a JAR file. The example assumes that the entries images/save.gif and images/cut.gif exist in the application's JAR files.
Example 8-3. Accessing resources in a JARDevelopers sign code for use with Java Web Start much like they do for Java applets: by using the standard jarsigner tool from the Java 2 SDK. The documentation for the jarsigner tool shows how to sign code, create test certificates, and other signing-related issues. For more on jarsigner, visit http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jarsigner.html.
8.2.4 Delivering a Web Start Application
In this case, you'll use the built-in Mac OS X implementation of Apache to serve JNLP files. To do this, you need to add the line shown below to your mime.types file, located in /etc/httpd/.
Using this implementation will ensure that Web Start applications are associated with JNLP and the proper programs on your Mac OS X machine. The easiest way to ensure this is to use a one-time execution of a command-line text editor from within Terminal:
You'll need to enter your password, and you'll see the text editor shown in Figure 8-10. Make the needed changes and quit out of Pico.
Figure 8-10. Using Pico to edit mime.types
|
You'll then want to restart Apache in the 'System Preferences Sharing' control panel (as shown back in Figure 8-2).
8.2.5 Creating a JNLP File
Before building a Web Start-based application, you'll need a JAR file. In this case, use the JAR file built in Chapter 7. You've been getting some mileage out of this application, as it was already deployed earlier in this chapter as an applet.
Then create a JNLP configuration text file, as shown in Example 8-4. Save this file as SimpleEdit.jnlp in your ~/Sites directory.
Example 8-4. JNLP configuration file
|
Next, create a simple HTML file to link to this JNLP file (so users have something to click on in their web browser). Save the contents of Example 8-5 as SimpleEditWebStart.html in the ~/Sites directory.
Example 8-5. HTML to launch a JNLP applicationYou should now be able to view the HTML page in your web browser by viewing http://127.0.0.1/~username/SimpleEditWebStart.html. Clicking on the 'Launch SimpleEdit' link will, depending on your web browser, prompt the user to save the JNLP file to disk or automatically launch Web Start. If the file is saved to disk, the user can then launch Web Start (and the SimpleEdit application) by double-clicking on the JNLP file.
8.2.6 JNLP in Detail
As you can see from the example, a JNLP file is a standard XML file. Most of the information contained in the file is fairly self-explanatory, but you'll need to modify some items to deploy your application on a 'real-world' server. These items are listed here:
The base URL for all relative HREF URLs in the rest of the JNLP file. If your test system is http://127.0.0.1/~wiverson but your production system is http://www.mycompany.com/games/, you can change just this attribute's value.
This attribute's value should be set to the name of the JNLP file.
This element should indicate the application's human-readable name. This becomes the default name for the application, and should be kept short.
This URL appears automatically in the Java Web Start management application as a clickable link.
This graphic is automatically converted to a local system icon if users save an application to their system. The graphic should be square, 64 x 64 pixels (Java Web Start will automatically resize this graphic as needed).
If an icon with the splash attribute is provided, this icon will be used when Java Web Start downloads or updates the application.
This tag must be present if the application is to be launched when not connected to the network. There are no configurable options; for more sophisticated control, you will probably want to include this option and then perform network availability checks within your application.
Java Web Start Mac Os 10.15
You should include one or more of these entries to refer to the various JAR files required by your application.
This entry is used to specify the main class for your application. Subentries can be provided to pass arguments to the application via argument tags. For example, if you wanted to load a SimpleEdit plug-in, you might pass in an argument as shown below:
In computing, Java Web Start (also known as JavaWS, javaws or JAWS) was a framework developed by Sun Microsystems (now Oracle) 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 included 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.[1] Next to this OpenWebStart provides an open source based implementation that is based on IcedTea-Web but offers more features and commercial support options.
Functionality[edit]
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.
Download Java Web Start For Mac
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[edit]
As of JDK9, Java applets are deprecated by Oracle with Java Web Start being the intended replacement.[2][3]
In March 2018, Oracle announced it will not include Java Web Start in Java SE 11 (18.9 LTS) and later. Developers will need to transition to other deployment technologies.[4]
Implementation[edit]
The developer prepares a special XML file with JNLP extension. This file describes the application requirements, code location, parameters and additional permissions (if any). The browser downloads this file as any other and (following its MIME type, application/x-java-jnlp-file
) 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 (such as files and the system clipboard) while restricting the application to authorized operations.
Sun introduced version 1.0 of Web Start in March 2001,[5] while 64-bit Windows support was added only in Java 6[6] (later than 64-bit Java was first available). Since J2SE 1.4 Web Start comes as a default part of Java Runtime Environment (JRE) called javaws
, computer administrators no longer have to install it separately.
Java Network Launching Protocol (JNLP)[edit]
Programmers often speak of the Java Network Launching Protocol (JNLP) 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 (JRE) 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. It includes the original 1.0 release, the subsequent 1.5 maintenance release, and as of 2006, the pending 6.0 maintenance release.[clarify]
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 (most commonly Java Web Start). 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 (images, css), 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 (such as images) 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 a URL to a webserver, which replies with a JNLP file (instead of a HTML file) for the application. The JNLP client parses this file, requests the resources specified (jar files), 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[edit]
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 (if already cached) and should be updated as a background process.
Pack200 compression[edit]
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.[7]
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[edit]
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[edit]
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.[8]
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.[9] 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.[10]
Webswing is a specialized web server for running Swing based Java applications in a browser.[11]
Notable applications[edit]
- ArgoUML – an UML diagramming application.
- CrossFTP – an FTP client and server.
- Elluminate Live – a web conferencing / virtual classroom program.
- Ganymede – a GPL-licensed network directory management system
- Genie Workbench – a set of film production automation tools.
- Genevestigator, access engine to the curated bioinformatical database.
- Jake2 – A Java port of Quake 2.
- JOSM – The Java OpenStreetMap editor.
- muCommander A file Manager and Norton Commander clone with SSH and ftp features
- PoxNora – a 3/4 perspective, turn-based strategy, collectible card game.
- Wurm Online – a 3D Massively Multiplayer Online Fantasy Simulator.
- yEd – a graph and diagram editor.
See also[edit]
- Zero Install, a similar system which works for non-Java applications.
- ClickOnce, Microsoft.NET's similar framework.
References[edit]
- ^ojdkbuild - WebStart, 2019-04-29, retrieved 2019-05-31
- ^JDK9 Release Notes
- ^https://blogs.oracle.com/java-platform-group/moving-to-a-plugin-free-web
- ^'Java Client Roadmap Update'(PDF). March 2018.
Oracle will not include Java Web Start in Java SE 11 (18.9 LTS) and later. Oracle will begin encouraging application developers and users to transition away from Java Web Start and encourage non-commercial consumers to remove any unused or non-supported Oracle JRE installations from their desktops.
- ^Java Web Start 1.0 press release
- ^Bug ID 4802695, Support 64-bit Java Plug-in and Java webstart on Windows/Linux on AMD64
- ^Pack200 and Compression for Network Deployment
- ^icedtea-web. open sourc implementation of web start
- ^'OpenWebStart'. OpenWebStart. Retrieved 2020-07-20.
- ^hendrik (2019-12-10). 'How open source saved WebStart'. GuiGarage. Retrieved 2020-07-20.
- ^'Webswing'. www.webswing.org. Retrieved 2019-07-10.
External links[edit]
- Java Web Start and JNLP at Curlie