Java logo icon

JavaTM Upgrade Guide: Upgrading
Applets From the Microsoft VM for Java to the Sun JRETM


This guide explains why and how to upgrade applets from the Microsoft Virtual Machine (VM) for JavaTM technology to the Sun Java Runtime Environment (JRETM). In 98% of cases, applets run unchanged under the Sun JRE. For the remaining 2% of cases, this document shows how to upgrade. The results of this upgrade are beneficial, as the Microsoft VM is based upon version 1.1, an early, 1997 version of Java technology. The latest, standards-compliant version from Sun Microsystems is JRE 6, released in December 2006, includes many enhancements over the early version.

Why Upgrade?

An important reason to upgrade applets is because Microsoft VM does not support or provide a Java technology implementation with any of its products. Microsoft has already discontinued shipping Java technology in the Internet Explorer web browser with the latest versions of its operating systems, which has two important implications:

The Microsoft VM, which is based upon 10 year old Java 1.1 technology, is clearly outmoded. On the other hand Sun Microsystem's VM, which is part of Sun JRE 6, is thoroughly standards compliant and up to date which makes another good reason for upgrading Java applets and applications to run on the Sun JRE.

Microsoft encourages developers to upgrade Java applets and applications to J# or C# languages. But, J# and C# run only in Microsoft Windows platform and do not offer cross-platform compatibility.

How to Upgrade?

To upgrade to the Sun JRE, follow these steps:

  1. Verify and Install the Sun JRE if it is not already installed in your computer.

  2. Validate whether your browser uses the Sun JRE and not the Microsoft VM.

  3. Test your applet with the Sun JRE to determine if the applet runs correctly. If the applet does not run correctly, find the problem in the list of Potential Upgrade Issues. Follow the >> hyperlink under Resolution column of each Exception or Symptom to see an article that discusses the synopsis, symptom, cause, resolution, and related information.

Although most applets run correctly in the Sun JRE, always test the applets.

Verifying and Installing the Sun JRE

To verify whether you already have the latest Sun JRE installed on your test computer, follow the instruction below:

You should see the coffee-cup icon labeled Java in the Control Panel. If you do not see the coffee cup icon in the Windows Control Panel, you do not have the latest version of the Sun JRE installed on your computer.

You can download and install the Sun JRE in your computer, from the url: http://java.com/java/download/index.jsp.

After you install the Sun JRE in your computer, you need to validate whether the Sun JRE is enabled for your web browser to run the applets.

Validating the VM or JRE for Your Web Browser

To validate whether your web browser uses Microsoft VM or Sun JRE go through the following steps:

  1. From the Start menu button, select Settings and then select Control Panel.

    The Control Panel opens. You should see the coffee-cup icon labeled Java in the Control Panel.

  2. Double-Click the coffee-cup icon labeled Java to launch the Java control panel as shown below:

    A screenshot of Java Control Panel


  3. In the Java Control Panel, click the Advanced tab.
  4. Under Settings, click on + icon against 'Default Java for browsers'.
  5. Ensure to select checkbox for the browser of your choice as shown below:

    A screenshot of Java Control Panel with Advanced Tab options

  6. Verify whether your browser is running the Sun JRE. If the browser is running the Sun JRE, when you run the applet you should see:

If 'Show console' is selected in the Java Control Panel (Advanced tab > Java console), the Java Console displays a Java version number, as shown in the next section. The version number indicates the Sun JRE that is being used by the browser.

Testing Your Applet

Run the applet in your web browser to test it. If you have a set of standard tests for running an applet, perform those tests.

If there is a compatibility issue, you will see details about it in the Java Console which pops up on the screen if 'Show console' is selected in the Java Control Panel (Advanced tab > Java console). The following figure shows a sample screenshot of the Java Console:

A sample screenshot of Java Console

For details about the Java Console, see the following url: http://java.sun.com/javase/6/docs/technotes/guides/plugin/developer_guide/console.html

Once you have confirmed that your applet works properly with the Sun JRE, you might want to consider the best way of deploying the Sun JRE for your customers. See Internet/Intranet Deployment of the Sun JRE.

Potential Upgrade Issues

When running an applet in a browser using the Sun JRE, you might come across the following potential issues, listed by exceptions and symptoms:

Exception
Resolution
java.lang.ClassFormatError thrown by ClassLoader.
>>
java.lang.ClassNotFoundException thrown by ClassLoader.
>>
java.security.AccessControlException thrown in the execution of java.beans.Introspector.setBeanInfoSearchPath().
>>
java.lang.ClassNotFoundException thrown by ClassLoader on the com.ms.security package.
>>
java.lang.ClassNotFoundException thrown by ClassLoader on the com.ms.* package.
>>
java.lang.ClassCastException thrown from the AWT Dispatch Event Thread when mouse moves over an applet frame.
>>
java.lang.NullPointerException thrown from a thread when Applet.start() or Applet.stop() is called.
>>
java.lang.NullPointerException thrown in java.awt.Graphics.drawString().
>>
java.lang.NullPointerException thrown in java.awt.Graphics.drawImage().
>>
java.lang.IllegalArgumentException thrown in java.awt.Color constructor.
>>
java.security.AccessControlException thrown in stop(), suspend(), or resume() method of java.lang.Thread.
>>
java.lang.InstantiationException: either code or object should be specified, but not both.
>>


Symptom
Resolution
Applet running in the Sun JRE is no longer signed after repackaging the signed .cab files as .jar files.
>>
Signed applet upgraded from .cab to .jar file throws a security exception when run in Microsoft VM.
>>
Unable to use certificates from the browser for client authentication.
>>
CJK (Chinese-Japanese-Korean) fonts, when displayed in bold, are difficult to read.
>>
Redirection between HTTP and HTTPS URLs is not followed.
>>

If you run into an issue not covered in the preceeding list, see Java Upgrade Forum.