java.lang.ClassNotFoundException Thrown by ClassLoader on com.ms.* Package


Symptoms

When running an applet in a browser by using the Sun JavaTM Runtime Environment (JRETM), a java.lang.ClassNotFoundException is thrown by ClassLoader on the com.ms.* package. The same applet runs without any error under the Microsoft Virtual Machine (VM).

Cause

The Microsoft VM provides many proprietary class libraries, including J/Direct, Application Foundation Classes (AFC), and Windows Foundation Classes (WFC). These packages are not available in the Sun JRE, so a java.lang.ClassNotFoundException is thrown when an applet runs in the browser.

Resolution

Migrate the applet source code from using the Microsoft proprietary class libraries to similar classes in the Java platform. The following table shows a list of Microsoft VM and Java Platform class libraries:

Microsoft VM Java Platform
J/Direct Java Native Interface
Application Foundation Classes Swing, Java 2D APIs
Windows Foundation Classes Swing, Java 2D APIs

Related Information

How to avoid potential pitfalls of Microsoft's non-standard SDK for Java
Trail: Creating a GUI with JFC/Swing
Download Archive: Java Native Interface
Lesson: Learning Swing with the NetBeans IDE