INFO: How Does the Virtual Machine Search for Java Classes?

ID: Q177168


The information in this article applies to:
  • Microsoft Win32 Virtual Machine for Java
  • Microsoft SDK for Java, versions 2.0, 2.01, 2.02, 3.0, 3.1
  • Microsoft Internet Explorer versions 4.0, 4.01 for Windows 95
  • Microsoft Internet Explorer versions 4.0, 4.01 for Windows NT 4.0


SUMMARY

This article talks about how the Microsoft virtual machine (Microsoft VM) searches for a class on the local machine and Web site.


MORE INFORMATION

When a class is requested, the Microsoft VM normally searches for it in the following order:

  1. Check all explicitly specified locations (typically supplied with the jview /cp command-line option, not applicable for applets).


  2. Check the locations specified in the HKLM\Software\Microsoft\Java VM\DevClasspath registry entry.

    NOTE: this registry entry is provided for development and testing, and may not be supported in a future release. Microsoft does not recommend relying on it for production purposes.


  3. Search packages in the Java Package Manager (JPM) marked as system (see notes below) packages.


  4. Check the locations specified in the HKLM\Software\Microsoft\Java VM\TrustedClasspath registry entry.


  5. Check the directory specified by the HKLM\Software\Microsoft\Java VM\TrustedLibsDirectory registry entry.


  6. Check the locations specified in the HKLM\Software\Microsoft\Java VM\Classpath registry entry.


  7. Check the directory specified by the HKLM\Software\Microsoft\Java VM\LibsDirectory registry entry.


  8. Check the locations specified in the CLASSPATH environment variable.


  9. Search packages in the JPM marked as non-system (see notes below) packages. Searching first for non-system classes in the specified namespace, then searching for non-system classes in no namespace (global namespace).


  10. If served from a Web page, the Microsoft VM additionally searches the following locations:

    • Any cabinet files referenced by the Cabinets applet parameter (in the order in which they appear in the HTML). If there is a Cabinets applet parameter, the Cabbase parameter and the Archive attribute (below) will not be searched.


    • The cabinet file referenced by the Cabbase applet parameter. If there is a Cabbase applet parameter, the Archive attribute (below) will not be searched.


    • Any zip or jar file referenced by the 'archive' attribute of the applet tag.




  11. Search the code base of the HTML.


Notes

  • The contents of the registry values for items 2, 4, and 6 and the environment variable in item 8 should contain a semi-colon-delimited list of directories, zip files, and/or jar files. Multiple entries will be searched in the order they appear. The registry values for items 5 and 7 may only specify a single directory.


  • The Java Package Manager (JPM) is a service used by the Microsoft VM to store and retrieve Java classes.


  • Classes loaded by steps 1-8 above are considered system classes. Classes loaded by steps 9-11 are considered non-system classes. Non-system classes are not loaded by the system class loader, but instead are loaded by an instance of a Java ClassLoader. Non-system classes are not global and will not interact with other non-system classes loaded by a different ClassLoader. All the standard packages installed with the Microsoft VM are system packages.


  • When a class is loaded by an untrusted caller from one of the specified locations and it is only safe for use by a trusted caller, an exception may occur when trying to call a method or access a member of the class.


Here are the requirements for a package installed into the JPM to be considered as system packages:
  • Must reside in the global namespace.


  • Must be signed with full permissions.


  • The .osd inside the installation CAB must specify the <SYSTEM/> tag for each package. If using the DUBUILD tool to create the CAB file, use the /S command line switch to specify system packages.



REFERENCES

Further information about the Java Package Manager can be found at the following Web site:

http://www.microsoft.com/java/
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/

Additional query words: search order class jpm

Keywords : kbIE400 kbIE401 kbSDKJava200 kbSDKJava201 kbSDKJava300 kbSDKJava310 kbSDKJava202 JVM jcab
Version : :; WINDOWS:2.0,2.01,2.02,3.0,3.1,4.0,4.01
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.