Microsoft KB Archive/169799

= Error J0051: Undefined package 'Lang' =

Article ID: 169799

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 1.0 Standard Edition
 * Microsoft Visual J++ 1.1 Standard Edition
 * Microsoft Visual J++ 6.0 Standard Edition
 * Microsoft Software Development Kit for Java 2.02
 * Microsoft Software Development Kit for Java 2.01
 * Microsoft Software Development Kit for Java 2.02
 * Microsoft Software Development Kit for Java 3.0
 * Microsoft Software Development Kit for Java 3.1
 * Microsoft Java Virtual Machine
 * Microsoft Internet Explorer 1.0
 * Microsoft Internet Explorer 2.0
 * Microsoft Internet Explorer (Programming) 2.01
 * Microsoft Internet Explorer 2.1
 * Microsoft Internet Explorer 3.0
 * Microsoft Internet Explorer 3.01
 * Microsoft Internet Explorer 3.02
 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer (Programming) 5_beta

-



This article was previously published under Q169799



IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring the Registry" Help topic in Regedit.exe or the "Restoring a Registry Key" Help topic in Regedt32.exe.



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. (NOTE: This is not specific to the 'lang' package, but could occur for any package whether implicitly or explicitly imported.)



CAUSE
This problem often occurs after installing a virtual machine for Java that supports the Java Package Manager (JPM). Beginning with Microsoft virtual machine (Microsoft VM) build 2252 (installed with Internet Explorer 4.0x or the SDK for Java 2.0x) and later, the JPM contains all the system classes. These Microsoft VM builds no longer require a Classes.zip file on the classpath at run-time.

Compilers that do not search the JPM will need to find the system classes on the conventional classpath ( \java\classes). To create a single zip file that contains all the system classes, see the RESOLUTION section of this article.



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:   If you have installed Internet Explorer 4.0x or later or the SDK for Java 2.0-3.1, classes.zip may not have been created on the installation machine. This is caused by a new feature of the Microsoft VM called the Package Manager (JPM). The JPM contains the system classes in this release of the Microsoft VM. In order to extract the classes from the JPM for use by tools (such as the Java compiler)that search the class path only, type the following in a command window:   clspack -auto This creates a new Classes.zip file in the \java\classes directory and automatically adds it to the classpath of the Microsoft VM. For more information on the clspack utility, please refer to the SDK for Java documentation available at http://www.microsoft.com/mscorp/java/   Add an existing Classes.zip to your classpath.

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT, you should also update your Emergency Repair Disk (ERD).  Load the registry editor (REGEDT32.EXE). Open the "HKEY_LOCAL_MACHINE" window. In the View dialog box, make sure the "Tree and Data" check box is selected.</li> Expand the SOFTWARE node.</li> Expand the Microsoft node.</li> Select the Microsoft virtual machine (Microsoft VM) node.</li></ol>

The classpath should read something like the following: <pre class="fixed_text">  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 Microsoft virtual machine. Show directories for class files. Add the directory for your Classes.zip file. </li> Download the latest build of the Microsoft virtual machine from http://www.microsoft.com/mscorp/java/, click Downloads, and follow the Developer Updates link.

The REFERENCE section below lists two Knowledge Base articles that discuss the availability of the current Microsoft virtual machine and how to automatically update the Microsoft virtual machine. You need to run clspack after the new VM is installed. See item #1 above.</li></ol>

<div class="references_section">