Microsoft SDK for Java

J0161-J0180

J0161 J0162 J0163
J0164 J0165 J0166
J0167 J0168 J0169
J0170 J0171 J0172
J0173 J0174 J0175
J0176 J0177 J0178
J0179 J0180  

J0161 - Cannot open source file: 'identifier'

The source file specified in the error message could not be opened. This error most likely occurs when either the filename specified is misspelled or the file does not exist. Check the location of the specified source file, and then compile again.

J0162 - Failed to initialize compiler - maybe you didn't set the class path?

The compiler failed to properly initialize. Check to ensure the CLASSPATH environment variable is set properly, and then compile again.

J0163 - Array 'identifier' missing array index

The compiler detected access to an array type, but the index value was missing. To access an element of an array, you must provide a valid integer index for the array.

The following sample illustrates this error.

public class Simple {
   
   int j[] = {1, 2, 3};
   
   void method1() {
      j[] = 0;
      // error: 'j' missing index value
   }
}

J0164 - Ambiguous import of class 'identifier' from more than one package

The compiler detected two or more import statements attempting to import identical class names from different packages. This error most likely occurs when two packages contain duplicate classes and both packages are imported into the same source file. Check the packages imported into the source file for duplicate classes. Remove the duplicate class from one of the packages or remove one of the import statements from the source file.

J0165 - Cannot throw exception 'identifier' from method 'identifier' -- it is not a subclass of any exceptions thrown from overloaded method 'identifier'

The compiler detected an override method attempting to throw more exceptions than the method it overrides. In Java, an override method may not be declared to throw more exceptions than the overridden method. Either change the exception thrown to one that the base class throws, or change the base class declaration to throw the exception type that the subclass needs to throw.

The following sample illustrates this error.

class ExceptionA extends Exception (
   // do something meaningful
}
class ExceptionB extends Exception {
   // do something meaningful
}
class AnotherClass {
   
   public void method1() throws ExceptionA {
      // do something meaningful
   }
}
public class Simple extends AnotherClass {
   
   public void method1() throws ExceptionA, ExceptionB {
      // error: cannot throw greater than 
      // one exception here
   }
}

J0166 - Cannot access member 'identifier' in class 'identifier' from 'identifier' -- it is in a different package

The compiler detected an invalid attempt to reference a member variable defined within a different package. This error most likely occurs when an attempt is made to access a protected member defined within another package.

J0167 - Cannot override non-static method 'identifier' with static method 'identifier'

The compiler detected an attempt to override a superclass method with a subclass method declared with the modifier static. When a method is overridden in a subclass, the method cannot raise or lower the access level of the method or apply the static modifier. Remove the static modifier from the overridden method declaration, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      // do something meaningful
   }
}
class Simple2 extends Simple {
   
   static public void method1() {
      // error: overriding superclass 'method1'
      // with a static method is not valid
   }
}

J0168 - The declaration of an abstract method must appear within an abstract class

The compiler detected a method declared with the modifier abstract within a class which was not defined as abstract. This error most likely occurs when a class was intended to be abstract but is missing the abstract modifier in the class declaration. Either change the class so it is declared as abstract or remove the modifier from the methods defined in the class.

The following sample illustrates this error.

public class Simple {
   
   abstract void method1();
      // error: class must also be abstract
}

J0169 - Cannot access 'identifier' -- only public classes and interfaces in other packages can be accessed

The compiler detected an attempt to access a non-public class or interface contained within another package. Only classes or interfaces defined with the modifier public can be accessed in other packages. Check the access level of the class or interface you are accessing in the other package and ensure that it is public.

J0170 - Cannot load predefined class 'identifier' -- is CLASSPATH set correctly?

The compiler attempted to load a predefined class, but was unable to find the appropriate file. This error most likely occurs when the CLASSPATH variable has not been set correctly. Check to ensure the CLASSPATH is set properly, and then compile again.

J0171 - Not used

This error message is currently not used.

J0172 - Not used

This error message is currently not used.

J0173 - Found class 'identifier' in package 'identifier' rather than package 'identifier'

The compiler found the specified class, but the class was not defined as a member of the correct package. This error most likely occurs when an import statement includes an incorrect package identifier for the class.

J0174 - Not used

This error message is currently not used.

J0175 - Cannot invoke method on 'null' literal

The compiler detected an attempt to call a method from the null keyword. Null is not a class object and provides no methods.

J0176 - Duplicate label 'identifier' nested inside another label with same name

The compiler detected a nested label that was the same as another label. Rename the label to something different then change all break and continue statements that reference the label, and then compile again.

The following sample illustrates this error.

public class Simple{
   void method1(){
      outsideLoop:
      for (int i=0;i<10;i++)
      {
         outsideLoop:  //error: duplicate label
         for (int x=0;x<10;x++)
         {
            break outsideLoop;
         }
         break outsideLoop;
      }
   }
}

J0177 - Not used

This error message is currently not used.

J0178 - Not used

This error message is currently not used.

J0179 - Not used

This error message is currently not used.

J0180 - Not used

This error message is currently not used.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.