Web Start Help

Web Start is a product from Sun 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.

You can try downloading Ptolemy II as a Web Start application by going to http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII2.0/webstart.htm

Web Start Features:

  • Support for multiple JVMS
  • jar file versioning, which allows users to update an application without dowloading the entire application
  • The developer can choose whether the user can download an application to run it later when not connected to the network.
  • Support for applets, applications in an applet like sandbox and full applications.
  • 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 one installs Web Start itself and then restarts your browser and downloads the Web Start enabled application.

    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, especially under Netscape 6. If the detection fails, the web page will contain text like:
       You need to Install Web Start from Sun before installing . . .
      
    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:
    3. the Java Web Start splash screen should come up and the download should start.
    4. or you should see a window that asks if you want to download the file or start up javaws. Click on Open using javaws.exe and then OK, and the Java Web Start splash screen should come up.
    5. If the Java Web Start splash screen comes up, then need not reinstall Web Start.
    6. If the Java Web Start splash screen did not appear, then download Java Web Start from http://java.sun.com/cgi-bin/javawebstart-platform.sh?
    7. Click on the Java Web Start installer executable
    8. Usually, the default location of c:\Program Files\Java Web Start is fine
    9. You may need to restart your browser and go back to the Web Start enabled application download page.
    10. 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

  • Under Windows, after you download the Web Start enabled demo, you can run it again by going to Start -> Programs -:> Java Web Start -> Java Web Start.
    This will bring up the Java Web Start Application Manager that will list all the Web Start enabled applications.
  • In the default, if you run the Web Start enabled application twice, a window will pop up asking you if you would like to install an icon for the application in your Start menu and on the desktop.
    This facility is controllable by the Java Web Start Application Manager application preferences found under File -> Preferences -> Shortcut Option.
    You can configure Web Start to always install application icons or to never install them
  • The File -> Preferences -> Advanced pane controls two output options that are useful for troubleshooting
    Show Java Console
    If checked, this will bring up the Java console which will report error messages in the application
    Log Output
    If checked, this will log the Java Console output to a file. This can be very useful if the application is crashing and the Java Console window is closed before you can read it.
  • To remove an application, mouse on the application and then select Application -> Remove Application
  • If an update to the application is available, a small yellow triangle will appear at the bottom of the Web Start application manager when the application is highlighted. It is unclear when updating occurs, but one way to trigger the update is to go back to the website where you initially downloaded the application and redownload it. In theory, only the changed jar files will be pulled over.
  • Troubleshooting Web Start

    Help while installing:
  • Limitations while installing
  • Sun documents: Readme - FAQ
  • Installing Java 3D for use with Web Start.
  • Setting up Netscape 6
  • Help while running:
  • Limitations while running
  • Setting up Console Output
  • Drive not ready message
  • Help for developers:
  • Remote Java Web Start Resources
  • How Web Start .jnlp files are built in Ptolemy II
  • File not found
  • Unsigned application requesting unrestricted access to system
  • Bad Mime Type
  • Help while installing

    Limitations while installing

  • Roughly half the size of the application download is consumed by the HTML documentation of the Ptolemy II Java classes.
  • It would be nice if we use the Web Start jar versioning system.
  • Web Start sometimes ignores beta JRE versions. You may find it necesary to install an earlier JRE version.
  • The Web Start Application manager can be used to add and delete JREs to the list of possible JRES to run. Try starting up Web Start and then do File -> Preferences -> Java If you already have JRE 1.4.x installed, you can browse to where it is located, probably c:\Program Files\Java\j2re1.4.2 and add it
  • 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 http://java.sun.com/products/java-media/3D/download.html 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. 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\j2re1.4.2 This value is the JRE that Java 3D should be installed in.
    2. Start up the Web Start Application Manager and do File -> Preferences -> Java and look at the command column of the table. The Ptolemy II Web Start edition will use a JVM that is 1.4 or later.

    Netscape 6

    If you are running under Netscape 6, then the links above may state that you need to install Web Start from Sun even if you already have it installed. The reason is that the Java Script code fails to detect Java Web Start under Netscape 6.

    A quick test is to click on one of the Vergil downloads and if you have Java Web start installed, either:

  • the Java Web Start splash screen should come up and the download should start.
  • or you should see a window that asks if you want to download the file or start up javaws. Click on Open using javaws.exe and then OK, and the Java Web Start splash screen should come up.
  • The Java Web Start FAQ at http://java.sun.com/products/javawebstart/faq.html#11 says:

    What are the supported browsers? JavaTM Web Start supports primarily Internet Explorer 4 or higher and Netscape 4.X. However JNLP files can be launched from any browser if the mime-type association is done correctly. Please note that JavaTM Web Start uses the browsers settings and may launch a browser to show a URL these may/may not work with unsupported browsers.

    JavaTM Web Start works with Netscape 6. However, you will manually need to register JavaTM Web Start with NS6. This is done in the Navigator/Applications section of the Navigator/Helper Application section. This will be done automatically in a later version of the JavaTM Web Start installer. back to top

    Netscape 6 Java Web Start Set up Instructions
    1. If necessary, download Java Web Start from http://java.sun.com/cgi-bin/javawebstart-platform.sh?
    2. Click on the Java Web Start download and install it.
    3. In Netscape 6, go to the preferences window: Edit -> Preferences
    4. Click on Navigator in the left hand Category pane
    5. Click on Helper Applications
    6. The File type application/x-java-jnlp-file should be listed. If it is, you are done, click on OK
    7. If application/x-java-jnlp-file was not listed, click on New Type
      Description of type:
      Java Web Start
      File extension:
      JNLP
      MIME Type:
      application/x-java-jnlp-file
      Application to use
      Choose to the javaws.exe binary, usually c:\Program Files\Java Web Start\javaws.exe
    8. Click on OK to close the New Type window
    9. Click on OK to close the Preference window
    10. You should now be able to download Java Web Start applications.

    Help while running

    Limitations while running

  • If you start up Ptiny then the splash window mentions Ptiny, but if you then hit Help -> about, the splash window is the standard full installation window which includes links to domains and demos that are not included in the Ptiny release.
  • Codegen does not work, there are path problems. The codegen mechanism looks for the makefile by reading $PTII, and tries to run make.
  • For Web Start installations, we should disable look inside on atomic actors.
  • The DSP Only quick tour window includes domains and demos that are not installed.
  • The GR domain is not likely to work because Java 3D is not installed.
    http://www.j3d.org/tutorials/quick_fix/auto_install.html
  • Drive not ready message

    If you are running older versions of the Java Virtual Machine, you may see a message that says something like:
    Drive not Ready . . .
    Abort Retry Cancel
    
    Upgrading to Java 1.3.1-02 seems to help

    For more information, see

  • http://forum.java.sun.com/thread.jsp?forum=38&thread=71610
  • http://forum.java.sun.com/thread.jsp?forum=38&thread=71491
  • Troubleshooting for developers

    Remote Java Web Start Resources

  • Sun Java Web Start Home Page
  • JNLP Specification
  • 05/01 Tech Tip Article simple services examples.
  • Apple's Web Start Home Page Under Mac OS X, the Java Web Start Application Manager can be found as Applications -> Utilities -> Java Web Start
  • Borland Web Start Page
  • Problems with Web Start and displaying images
  • JavaHelp bug
  • Unofficial Web Start FAQ
  • Using Web Start with Java 3D
  • Venus Application Publisher - package, sign and publish Java (TM) Network Launching Protocol (JNLP) software.
  • 7/01 Javaworld article
  • IBM Article Java Web Start: Developing and Distributing Java Applications Steven Kim
  • http://openjnlp.nanode.org/
  • JINI and JNLP
  • Java URL
  • Marc's Web Start Kamasutra Information about Web Start and Java 3D
  • 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.
  • Unofficial FAQ about bad mime type
  • Question about cookies
  • 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.