Microsoft SDK for Java

J0141-J0160

J0141 J0142 J0143
J0144 J0145 J0146
J0147 J0148 J0149
J0150 J0151 J0152
J0153 J0154 J0155
J0156 J0157 J0158
J0159 J0160  

J0141 - Argument cannot have type 'void'

The compiler detected a method argument defined as type void. The void type can only be used for method return values to declare a method has no return value. Change the data type of the argument, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1(void i) {
      // error: type void can only 
      // be used as a return value
   }
}

J0142 - Cannot make static call to abstract method 'identifier'

The compiler detected an attempt to directly call an abstract method. Abstract methods are defined to provide a definition of a method to be implemented by subclasses and thus abstract methods do not have implementation code. Because of this lack of implementation in an abstract method, calling an abstract method using the super keyword is invalid.

The following sample illustrates this error.

abstract class Simple {
   
   abstract int method1();
}
class SimpleSubclass extends Simple {
   
   int method1() {
      
      return super.method1();
      // error: 'method1' must be 
      // implemented instead
   }
}

J0143 - Cannot throw exception 'identifier' from static initializer

The compiler detected an attempt to throw an exception from within a static initializer. This error most likely occurs when a throw statement is called or an initialization of a static class instance occurs within a static initializer. To capture exceptions from static class instance initializations in a static initializer, use a try and catch block combination.

The following sample illustrates this error.

public class Simple {
   
   static {
      ThrowClass TClass = new ThrowClass();
      // error: cannot throw exceptions 
      // within static initializers
   }
}
class ThrowClass {
   
   ThrowClass() throws Exception{}
   
}

J0144 - Cannot find definition for interface 'identifier'

The compiler could not locate a definition for the named interface. This error most likely occurs when an implemented interface is either missing or misspelled. Verify the location and name of the interface you are implementing, and then compile again.The following sample illustrates this error.

public class Simple implements Bogus {
   // error: the interface 'Bogus' does not exist
   
}

J0145 - Output directory too long: 'identifier'

The output directory exceeded 228 characters in length. Try shortening the length of the output directory path, and then compile again.

J0146 - Cannot create output directory 'identifier'

The output directory could not be created. This error most likely occurs when you do not have write permission on the specified drive.

J0147 - Cannot access private member 'identifier' in class 'identifier' from 'identifier'

The compiler detected an invalid attempt to access a private member contained within another class. Private class members are only accessible from within the member's class.

The following sample illustrates this error.

class AccessClass {   
   private int i = 0;   
}
public class Simple {
   
   public void method1() {
      
      AccessClass ac = new AccessClass();
      
      ac.i = 1;
      // error: cannot access 'i'
   }
}

J0148 - Cannot reference instance method 'identifier' before superclass constructor has been called

The compiler detected an attempt to reference an instance method before the superclass constructor was called. This error most likely occurs when a base class method is called from within a subclass's constructor using the super() method. This error can also occur if the subclass calls its own methods from the constructor using the this() method. Because instances of the subclass and base class have not been instantiated at the time the constructor is called, this error occurs. To avoid this situation, use the super statement to call a base class method, and use the this statement to call a subclass method.

The following sample illustrates this error.

abstract class Simple {
   
   Simple(int i) {}
   
   int method1() {
      
      return 0;
   }
}
class SimpleSubclass extends Simple {
   
   SimpleSubclass() {
      
      super(method1());
      // error: constructor must be called first
   }
}

J0149 - Not used

This error message is currently not used.

J0150 - Cannot have repeated interface 'identifier'

The compiler detected an interface name being repeated within a class declaration. This error is most likely caused when a class implements a large number of interfaces and an interface has a duplicate entry in the implements list. Check to make sure you do not have a duplicate interface entry, and then compile again.

J0151 - Variable 'identifier' is already defined in this method

The compiler detected two variables with the same name that are defined twice within the same scope of a method. Make sure that a variable has not been defined twice in the same scope, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int i = 1;
      int i = 0;
      // error: 'i' defined twice within
      // the same scope
   
   }
}

J0152 - Ambiguous reference to 'identifier' in interfaces 'identifier' and 'identifier'

The compiler detected an ambiguous reference to an identifier. The identifier may have been declared in two or more interfaces, and the compiler could not determine which reference to use. Make sure that you do not have two interfaces with the same field defined.

The following sample illustrates this error.

interface Interface1 {
    final int i = 0;
}
interface Interface2 {
    final int i = 1;
}
public class Simple implements Interface1, Interface2 {
   int method1() {
      return i; //Error, the class implements two
                //interfaces that define 'i' separately.
   }
}

J0153 - Not used

This error message is currently not used.

J0154 - Not used

This error message is currently not used.

J0155 - Not used

This error message is currently not used.

J0156 - Not used

This error message is currently not used.

J0157 - Not used

This error message is currently not used.

J0158 - Class 'identifier' already defined

The compiler detected two or more classes defined with the same name. Make sure that you do not have the class defined more than once in the same source file. This error can also occur if a class is duplicated by an imported class. Rename one of the classes or remove the duplicate instance, and then compile again.

The following sample illustrates this error.

public class Simple {
   // do something meaningful
}
class Simple {
   // error: class 'Simple' already defined
}

J0159 - '@' must be followed by the response file name

The compiler detected the @ character on the jvc command line, but did not detect a valid response file name immediately following it. Supply the response file name, and then compile again.

J0160 - response file 'identifier' could not be opened

The compiler could not open the specified response file. This error most likely occurs when the response file name is misspelled or the file does not exist.

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