Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/172794

From BetaArchive Wiki



PRB: Error J0049: Undefined Name 'Package'

Last reviewed: February 10, 1998
Article ID: Q172794



The information in this article applies to:

  • Microsoft Visual J++, versions 1.0, 1.1

SYMPTOMS

Creating a class whose name is the same as the \package in which it resides generates the following error when compiling a Java program that imports this package:

   error J0049: Undefined name 'package'

Where "package" is the name of your package.

RESOLUTION

To workaround the problem, import the class name explicitly into your Java program or rename the class to ensure that it has a different name than the package. This problem has also been corrected see the STATUS section below for the current fix.

STATUS

This problem has been fixed with the Microsoft compiler for Java (Jvc.exe) version 1.02.4224 that is included with the Microsoft SDK 2.0 for Java Beta2. The SDK for Java is available at http://www.microsoft.com/java/.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Java project called LibX and specify the location as C:\LibX.
  2. On the ClassView pane, right-mouse click and Create a New Class called "Lib," which Extends Frame, and in the package Edit Box specify "Lib" as the package name and check the Public Access Specifier.
  3. Include the following code to the Lib.java file that was created from Step 2.

    Note: Replace the "import java.awt.frame" that Visual J++ generates with the following import statements:

          import java.applet.*;
          import java.awt.*;

    // // // Lib // // public class Lib extends Frame { //constructors ... public Lib() { } public static void Method1(String msg) { } }

  4. Build the Lib package.
  5. Also include c:\LibX to the CLASSPATH. One way of doing this is to run REGEDIT from the command-line and select:

           HKEY_LOCAL_MACHINE

    SOFTWARE Microsoft Java VM Edit the Classpath Key to include c:\LibX.

  6. Using Visual J++ 1.1, create a new default Java Applet Wizard named "MyApplet" in the location c:\LibX.
  7. Include import Lib.*; to the beginning of MyApplet and also include the following code to the init() method of MyApplet.java:

          import Lib.*;
          ...
          public void init()
          {

    resize(320, 240); Lib.Method1("ssss"); Lib myLib=new Lib(); }

  8. When you build MyApplet.java, you will see the above error.

REFERENCES

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: package jvc undefined

Keywords : VJGenIss
Technology : kbInetDev
Version : WINDOWS: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 10, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.