PRB: Error J0051: Undefined package 'lang'

Last reviewed: February 18, 1998
Article ID: Q169799
The information in this article applies to:
  • Microsoft Visual J++, versions 1.0, 1.1
  • SDK for Java versions 2.0, 2.01
  • Microsoft Win32 Virtual Machine for Java

SYMPTOMS

The following compiler error appears when you try to build simple Java Applets or Applications:

   error J0051: Undefined package 'lang'

This article discusses the possible reasons why this error occurs.

CAUSE

This problem happens if the compiler is unable to find the package, or if the registry entry that defines the classpath is incorrect.

RESOLUTION

The MORE INFORMATION section contains a checklist that provides some of the common fixes for this error.

MORE INFORMATION

Following is a checklist that provides some of the common fixes for this error:

  1. If you have installed IE 4.0x or the SDK for Java 2.0x, classes.zip may not have been created on the installation machine. This is caused by a new feature of the Java VM called the Package Manager (JPM). The JPM contains the system classes in this release of the VM. In order to extract the classes from the JPM for use by tools that search the class path only, type the following in a command window:

          type "clspack -auto" (without quotation marks)
    

    This creates a new Classes.zip file in the <windir>\java\classes directory. For more information on the clspack utility, please refer to the SDK for Java documentation available at http://www.microsoft.com/java/.

  2. Add an existing Classes.zip to your classpath.

    a. Load the registry editor (REGEDT32.EXE). b. Open the "HKEY_LOCAL_MACHINE" window. c. In the View dialog box, make sure the "Tree and Data" check box is

          selected.
    
    d. Expand the SOFTWARE node. e. Expand the Microsoft node. f. Select the Java Virtual Machine (VM) node.

    The classpath should read something like:

          C:\windows\java\classes\classes.zip;C:\windows\java\classes;.
    

    You can also load Developer Studio and on the Tools menu, click Options to open the Options dialog box. Click the Directories tab. Make sure the platform is Java Virtual Machine. Show directories for class files. Add the directory for your Classes.zip file.

  3. Download the latest build of the Microsoft Virtual Machine for Java from http://www.microsoft.com/java/ and click Downloads. The REFERENCE section below lists two Knowledge Base articles that discuss the availability of the current Java Virtual Machine and how to automatically update the Microsoft Virtual Machine for Java. You need to run clspack after the new VM is installed. See item #1 above.

REFERENCES

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q163638
   TITLE     : HOWTO: Automatically Update the Microsoft VM for Java

   ARTICLE-ID: Q163637
   TITLE     : INFO: Availability of Current Build of Microsoft VM for Java

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/

Keywords          : kbenv AWTPkg JVM
Technology        : kbInetDev
Version           : 1.0 1.1
Platform          : WINDOWS
Issue type        : kbprb


================================================================================


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: February 18, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.