java.lang.ClassNotFoundException is thrown in Sun VM for classes put in Microsoft VM search path


Symptoms

When running an applet that requires classes stored in Microsoft VM search path, in a browser using the Sun JRE, a java.lang.ClassNotFoundException is thrown. The same applet works in Microsoft VM.

Cause

Microsoft VM provides various ways for developers to put their classes and native libraries in the Microsoft VM search path:

%SYSTEMROOT%\Java\TrustClassesfor trusted CLASS files
%SYSTEMROOT%\Java\TrustLibfor trusted JAR/CAB files
%SYSTEMROOT%\Java\Classesfor untrusted CLASS files
%SYSTEMROOT%\Java\Libfor untrusted JAR/CAB files
%SYSTEMROOT%for DLL

Sun VM does not support these search path.

Resolution

The workaround is to put the classes and jars in Sun VM search path instead:

{java.home}\lib\appletfor untrusted JAR files
{java.home}\lib\extfor trusted JAR files
%SYSTEMROOT%for DLL

where {java.home} is the install directory of J2RE.

Note:

  1. Sun VM does not support CAB, so any file packaged as CAB for Microsoft VM must be repackaged as JAR to be used in Sun VM.

  2. Sun VM does not support search path for trusted/untrusted CLASS files on the system. Developers may workaround this by packaging CLASS files as trusted/untrusted JAR file.

Related Information

See http://support.microsoft.com/default.aspx?scid=kb;EN-US;177168 for more details on MSVM search path