Web Start Help

Contents

Overview

Web Start is a Java-based product that uses the Web to download applications.

The first time a user downloads a Web Start application, they need to download the Java Web Start client. That client includes a JVM and an application manager that allows the user to configure Web Start and any downloaded Web Start applications.

To run Webstart apps Mac OS 10.8 of 10.9, see this video: http://www.youtube.com/watch?v=k096TK3Pzd8

There are at least two types of Web Start downloads available from the Ptolemy site:

  1. Web Start downloads for individual models from books and papers such as:
    Claudius Ptolemaeus, Editor, "System Design, Modeling, and Simulation Using Ptolemy II," Ptolemy.org, 2014.
  2. Web Start downloads for a significant portion of the Ptolemy II visual editor

Web Start Features:

The best thing about Web Start is that it is easy to update a small part of the application and then the next time the users run the app, they will download just the updated portion instead of having to download the entire application and reinstall.

The way Web Start works is that developers create jar files that are collections of Java .class files, images, platform dependent libraries and other resources. An application consists of multiple jar files and a .jnlp file that describes the application.

Since shipping a standalone installer usually requires splitting an application up into components anyway, then the exercise of building jar files is a useful one, since the jar files could be used for other installers such as InstallAnywhere or InstallShield. I use Web Start as a test bed for figuring out which files need to be shipped. Using Web Start for this is usually much faster than running InstallAnywhere or InstallShield, since if there is a problem in only one jar file, then only that jar file is affected, and I don't necessarily need to rebuild a large installer.

In theory, one can ship one large jar file, but that makes updating the application more difficult, since if the application changes, the entire jar file will be downloaded unless a somewhat more complex jar diff system is used.

The jar files and the .jnlp file may or may not be signed by using a Sun Java code signing certificate. If all the jars are signed, then the application can have access to the local disk, and basically looks like a regular application. If the jars are not signed, then access is limited. It is also possible to run the application in 'sandbox' mode, which is fairly restrictive, but can still do some useful things.

One can use a temporary code signing certificate and eventually pay Verisign $400/year for a permanent code signing certificate.

Installing Web Start

The basic procedure is that Web Start is included as part of the Java Runtime Environment (JRE) and the Java Development Kit (JDK). After the JRE or JDK is installed it is sometimes necessary to restart your web browser. At runtime, a .jnlp file is downloaded and the browser invokes Java.

  1. Usually, the web page that includes the Web Start enabled application download attempts to detect if you already have Web Start installed. If the Web Start detection succeeds, then you need not reinstall Web Start.
    However, the Web Start detection can fail If the detection fails, then you will be prompted to install the Java Runtime Environment.
  2. You may already have Web Start installed, so you may want to try clicking on the Web Start enabled application download and if you have Java Web start installed, either: If the Java Web Start splash screen comes up, then need not reinstall Web Start.
  3. If the Java Web Start splash screen did not appear, then download the Java Runtime Environment (JRE), which contains Java Web Start, from http://www.oracle.com/technetwork/java/javase/downloads/index.html
  4. You may need to restart your browser and go back to the Web Start enabled application download page.
  5. Note that the Ptolemy II Web Start applications may be signed with a certificate that is not registered with a certificate authority, so you may be prompted with a window stating that the certificate from Claudius Ptolemaus is unknown. You should hit the OK button to proceed with the download

Java Web Start Application Manager

Java applications are cached on your disk. To view them, use the Java Control Panel.

Windows: Opening the Java Control Panel

To open the Java Control panel, go to Start -> Settings -> Control Panel and then double click on the Java icon (or search for Java). The Java Control Panel with start up.

Mac OS X: Opening the Java Control Panel

The Java Control Panel is under the Mac OS "Other" Control Panels.

Using The Java Control Panel

Troubleshooting Web Start

Help while installing: Help while running: Help for developers:

Help while installing

Ptolemy Limitations while installing

Web Start Problems with Mac OS X:

Under recent versions of Mac OS X, clicking a Web Start JNLP file results in a dialog that states that the application is from an unsigned developer.

Mac Dialog: Unsigned App

There are at least three workarounds:

  1. Click on the question mark in the lower left and follow the suggestions (which are repeated below).
  2. Under Mac OS X, the .jnlp file is downloaded and typically saved in the ~/Downloads directory. Find the .jnlp file in the Mac OS X Finder, right click on the file and select Open With -> Java Web Start.
  3. Use the Security Preference to either allow unsigned applications or open the recently downloaded unsigned application.

Web Start Problems with Mac OS X Firefox

The summary is that Java is not very well supported under Firefox on the Mac.

Under Mac OS X, if you have problems with Web Start under Firefox, try using Safari.

Below are some things to try under Mac OS X for Firefox. In theory the JavaScript that is invoked by the "Launch" button should install the Oracle JRE, but in practice, there are problems.

Installing Java 3D for use with Web Start

In theory, Web Start can install Java 3d automatically, but this is somewhat tough to do. We have only tested out Java 3D 1.2.1_03 API under JDK1.3.1.

There are problems with Java 3D 1.2.1_03 API under JDK1.4.0, when I run a Java3D app, we get:

    Fail to create back buffer - DDERR_INALIDPARAM
  

The workaround is to use JDK1.3.1

Below are some instructions on installing Java3D: Go to https://java3d.dev.java.net/ and download Java 3D for Windows (DirectX Version) Runtime for the JRE

Click on the installer. Eventually, it will prompt you for the JRE to install Java 3D in. You should install it under the same JRE that you are running in Web Start. There are at least two ways to determine which JRE you are running:

  1. Start up Ptolemy, go to a model, do View -> JVM Properties and look at the java.home property. The value of the java.home property should be something like
    C:\Program Files\JavaSoft\Java\jre7 (Windows) or
    /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home (Mac OS X) BTW - This value is the JRE that Java 3D should be installed in.
  2. Start up the Java Control Panel, go to the Java pane and click on View. The command that will be run will in the Path column.

Developers: see $PTII/mk/jnlp.mk (search for Java3D) for how to create your own signed Java3D files.

Help while running

Limitations while running

Troubleshooting for developers

Remote Java Web Start Resources

How Web Start .jnlp files are built in Ptolemy II

In Ptolemy II, the Java Web Start template files are at: $PTII/vergil.jnlp.in, $PTII/vergilPtiny.jnlp.in and $PTII/vergilPtiny.jnlp.in.

$PTII/mk/jnlp.mk contains the rules that process the *jnlp.in files and generates *.jnlp files.

If the Web Start application is to have full access to the machine, then the application needs to be signed, which means that the .jnlp file needs to be copied into the jar file that has the main() method and the entire jar file signed.

Since we use the same main() for more than one application and each application has a separate .jnlp file, it is necessary to create a separate java class and jar file for each application. Those jar files are found in $PTII/ptolemy/actor/gui/jnlp.

File not found

Starting up vergil and clicking on the mainVergil.htm link yields
    java.io.FileNotFoundException: JAR entry doc/mainVergil.htm not found in 
    C:\Program Files\Java Web Start\.javaws\cache\file\D\P-1
    \DMc&c\DMusers\DMcxh\DMptII\DMptolemy\RMptolemy.jar
    at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source)
    at javax.swing.JEditorPane.getStream(Unknown Source)
    at javax.swing.JEditorPane.setPage(Unknown Source)
    at ptolemy.actor.gui.HTMLViewer.setPage(HTMLViewer.java:195)
    at ptolemy.actor.gui.HTMLViewerTableau$Factory.createTableau(HTMLViewerTableau.java:169)
    at ptolemy.actor.gui.TableauFactory.createTableau(TableauFactory.java:116)
    at ptolemy.actor.gui.Configuration.createPrimaryTableau(Configuration.java:151)
    at ptolemy.actor.gui.Configuration.openModel(Configuration.java:267)
    at ptolemy.actor.gui.HTMLViewer.hyperlinkUpdate(HTMLViewer.java:139)
    at javax.swing.JEditorPane.fireHyperlinkUpdate(Unknown Source)
  
http://forums.java.sun.com/thread.jsp?forum=38&thread=71621 says:
    I had this problem several months back and putting the following
    line (I put this code early in Jbinit() ):

    ClassLoader loader=this.getClass().getClassLoader();
    Thread.currentThread().setContextClassLoader(loader);

    hope this helps, md
  
URLClassLoader fails when a URL points to a JAR inside another JAR

It turns out that is is necessary to modify Ptolemy II so that if it is looking for a resource and fails then we should try stripping out the text before the jar URL !/ separator and look for the resource in the classpath.

Another thing to look for is hrefs that are relative and use ../ instead of ptolemy/. Relative URLS will not work when looking for resources using the classpath

"Unsigned application requesting unrestricted access to system"

  1. Start up Web Start, clear the cache and reload.
  2. Check that the jar files are signed: cd $PTII; make jnlp_verify
    If one of the jar files will not verify, use jar -tvf file.jar to verify that the file actually has data files in it
  3. Resign the jar files: cd $PTII; make jnlp_clean jnlp_all
  4. Rebuild the jar files: cd $PTII; make clean install

Bad Mime Type

When trying to fetch a .jnlp file from a server with cookie authentication, I sometimes have seen:
    Bad MIME type returned from server when accessing resource: 
    http://www.gigascale.org/ptolemy/src/ptII/vergil.jnlp - text/html
  
I think the problem is with the second time the jnlp file is fetched.
I can run JNLP on the ptolemy web server with basic password based authentication turned on.
I think the problem is that cookies are not yet supported.
The basic password authentication mechanism is a little funky, sometimes the app starts up without checking for updates.

Spaces in path names

Web Start does not work very well if the pathname to the vergil.jnlp file has spaces in it. The workaround is to place your Ptolemy II tree in a directory that does not have spaces in the path name if you plan on using Web Start.