2.6. Run Applets in WebStart with JNLP file

Trying to run Java Applets in newer browsers and/or with newer Java versions can lead to problems with Applets being deprecated or not supported any more. Officially were Applets blocked to run in common browsers from about year 2016. However, it is still possible to run Applets in a similar use case as before (open a Java application from a remote server via your browser) thanks to Java WebStart technology that's supported by Java 8. Both Applets and Java Web Start are marked as deprecated technologies from Java 9.

Click to view larger image

Applets vs WebStart

In this case, EspressChart is Java 8 compiled application and is best to use it with Java 8. For using Applets with WebStart in newer versions, you must use some different implementation of WebStart. Popular choices are OpenWebStart or IcedTea-Web and it is already included in some newer Java distributions.

To run a Java Applet via a Java Web Start JNLP file, you have to specify the applet-desc parameter in the JNLP file configuration file.

   <applet-desc
      name="Chart Viewer"
      main-class="quadbase.chartviewer.Viewer"
      width="800"
      height="600">
	<param name="filename" value="help/examples/ChartAPI/data/test.tpl"/>
	<param name="preventSelfDestruct" value="true"/>
  </applet-desc>

The param tags specify parameters for the applet. The parameters are different for each applet. The specific parameters are mentioned in the documentation chapter for each applet.

JNLP files can be either run locally when the required libraries (containing the compiled source code) are loaded as a local file or remotely when the libraries are loaded via HTTP/HTTPS.

To run an Applet in a JNLP file remotely via HTTP/HTTPS, the EspressManager has to be run as a servlet in an application server. See the following chapter to learn how to do that: Section 2.3.1 - Starting EspressManager as a Servlet

When running JNLP files remotely via HTTP/HTTPS, the parameters comm_protocol, comm_url and servlet_context need to be added to the applet-desc element. You can either fill in the values manually (as the following code example shows) or you can have the values filled automatically in a JSP file.

<applet-desc
	 name="Espress Report Designer"
	 main-class="quadbase.reportdesigner.designer.ReportClient"
	 width="380"
	 height="160">
	<param name="comm_protocol" value="servlet"/>
	<param name="comm_url" value="http://127.0.0.1:8080"/>
	<param name="servlet_context" value="Espress70/servlet"/>
</applet-desc>
[Note]Note

If you want to pre-fil the values automatically in a JSP file, the actual values highly depend on your server configuration. The previous example is just illustrative.