PRB: Error Message After You Import java.util.* and java.awt.* (325593)



The information in this article applies to:

  • Microsoft Visual J# .NET (2002)
  • Microsoft Visual J# .NET (2003)

This article was previously published under Q325593

SYMPTOMS

When you import java.awt.* and java.util.* and then use the List class, you may receive the following compiler error message:
error VJS1185: Type 'List' is imported by at least two 'import-on-demand' statements

CAUSE

Both java.util and java.awt contain List classes, and the compiler does not know which class to use.

RESOLUTION

Fully qualify List when you use it to distinguish between java.awt.List and java.util.List.

STATUS

This behavior is by design.

MORE INFORMATION

The following code demonstrates this error when it is compiled with the Visual J# .NET compiler:
import java.awt.*;
import java.util.*;

class Class1
{
    List l;
}
				
To correct the compiler error, fully qualify the List class:
    java.awt.List l;
				

Modification Type:MajorLast Reviewed:8/7/2003
Keywords:kbprb KB325593