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

Last reviewed: January 29, 1998
Article ID: Q177168
The information in this article applies to:
  • Microsoft Win32 Virtual Machine for Java
  • SDK for Java, version 2.0, 2.01
  • Microsoft Internet Explorer for Windows 95, versions 4.0, 4.01
  • Microsoft Internet Explorer for Windows NT 4.0, versions 4.0, 4.01

SUMMARY

This article talks about how the Java Virtual Machine searches for a class when it is requested on the local machine or if it is served from a Web page.

MORE INFORMATION

The Java Package Manager (JPM) is a service used by the Java Virtual Machine (JVM) to store and retrieve Java classes.

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

  1. Check explicitly specified path (typically supplied with the /cp. command-line option).

  2. Check 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 JPM-installed classes.

  4. Check the HKLM\Software\Microsoft\Java VM\TrustedClasspath registry entry. (This applies only to applications and trusted applets.)

  5. Check the HKLM\Software\Microsoft\Java VM\TrustedLibsDirectory registry entry. (This applies only to applications and trusted applets.)

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

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

  8. Check the CLASSPATH local environment variable.

  9. However, if served from a Web page, the JVM additionally searches for the class in 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
          will be clear.
    

        - The cabinet file referenced by the Cabbase applet parameter. If
          there is a Cabbase applet parameter, the Archive attribute will
          be clear.
    

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

  10. Check for any classes relative to the code base of the HTML.

REFERENCES

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

   http://www.microsoft.com/java/sdk/20/pkmanagr/jpm.htm

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page 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 : JCab JVM
Technology : kbInetDev
Version : WINDOWS:2.0,4.0
Platform : WINDOWS
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 29, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.