FIX: Error J0049: Undefined name "XXX" in Visual J++ (158221)



The information in this article applies to:

  • Microsoft Visual J++ 1.0
  • Microsoft Visual J++ 1.1

This article was previously published under Q158221

SYMPTOMS

When the simple name of the package that you are creating is the same name as the package prefix that contains the class you are importing, the following compile time error occurs:
Error J0049: Undefined name "XXX"
Where "XXX" is the package name that the user imported.

WORKAROUND

You can work around this error by using a different name for the package that you import, or you can change the name for the package that you are creating.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in the updated Java Language Compiler (jvc) from the SDK for Java 2.01 and Service Patch 3 for Visual Studio. Both the compiler from the SDK for Java and the Service Patch 3 are needed to resolve the problem.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a Java workspace that contains the following classes:
          //[Test1.java]
          package mypacket.bar;
          import bar.Test2;
    
          class Test1
          {
          }
    
          //[Test2.java]
          package bar;
    
          class Test2
          {
          }
    					
  2. Set the output directory to some valid directory on disk.
  3. Try to build the project.
The Error J0049: Undefined name "bar.Test2" appears.

REFERENCES

For more information about where to obtain Service Patch 3, see the following article in the Microsoft Knowledge Base:

170365 INFO: Visual Studio 97 Service Packs - What, Where, and Why

For more information about Java developments at Microsoft, visit the following Microsoft Web site: For more information about Updating the Visual J++ 1.x compiler, please see the SDK for Java documentation and the following article in the Microsoft Knowledge Base:

177165 INFO: Use New Java 1.1 Language Features with Visual J++ 1.1

For the latest Knowledge Base articles and other support information about Visual J++ and the SDK for Java, see the following page on the Microsoft Product Support Services Web site:

Modification Type:MinorLast Reviewed:11/17/2005
Keywords:kbArtTypeINF kbbug kbfix KB158221