Working with MS VM
 
 

Tools   Tools
Jvc Reference   Tools

 

JVC Errors and Warning Messages

This page contains a listing of all JVC Errors and Warning Messages produced by this compiler.

Error Message Links

J0001 J0021 J0041 J0061 J0081 J0101 J0121 J0141 J0161 J0181 J0201 J0221 J0241
J0002 J0022 J0042 J0062 J0082 J0102 J0122 J0142 J0162 J0182 J0202 J0222 J0242
J0003 J0023 J0043 J0063 J0083 J0103 J0123 J0143 J0163 J0183 J0203 J0223
J0004 J0024 J0044 J0064 J0084 J0104 J0124 J0144 J0164 J0184 J0204 J0224
J0005 J0025 J0045 J0065 J0085 J0105 J0125 J0145 J0165 J0185 J0205 J0225
J0006 J0026 J0046 J0066 J0086 J0106 J0126 J0146 J0166 J0186 J0206 J0226
J0007 J0027 J0047 J0067 J0087 J0107 J0127 J0147 J0167 J0187 J0207 J0227
J0008 J0028 J0048 J0068 J0088 J0108 J0128 J0148 J0168 J0188 J0208 J0228
J0009 J0029 J0049 J0069 J0089 J0109 J0129 J0149 J0169 J0189 J0209 J0229
J0010 J0030 J0050 J0070 J0090 J0110 J0130 J0150 J0170 J0190 J0210 J0230
J0011 J0031 J0051 J0071 J0091 J0111 J0131 J0151 J0171 J0191 J0211 J0231
J0012 J0032 J0052 J0072 J0092 J0112 J0132 J0152 J0172 J0192 J0212 J0232
J0013 J0033 J0053 J0073 J0093 J0113 J0133 J0153 J0173 J0193 J0213 J0233
J0014 J0034 J0054 J0074 J0094 J0114 J0134 J0154 J0174 J0194 J0214 J0234
J0015 J0035 J0055 J0075 J0095 J0115 J0135 J0155 J0175 J0195 J0215 J0235
J0016 J0036 J0056 J0076 J0096 J0116 J0136 J0156 J0176 J0196 J0216 J0236
J0017 J0037 J0057 J0077 J0097 J0117 J0137 J0157 J0177 J0197 J0217 J0237
J0018 J0038 J0058 J0078 J0098 J0118 J0138 J0158 J0178 J0198 J0218 J0238
J0019 J0039 J0059 J0079 J0099 J0119 J0139 J0159 J0179 J0199 J0219 J0239
J0020 J0040 J0060 J0080 J0100 J0120 J0140 J0160 J0180 J0200 J0220 J0240

Warning Message Links

J5001 J5002 J5003 J5004 J5005 J5006 J5007 J5008 J5009 J5010
J5011 J5012 J5013 J5014 J5015 J5016

J0001 - INTERNAL COMPILER ERROR: 'identifier'

The compiler was unable to recover after detecting an error. Contact Microsoft Product Support Services for further assistance on how to resolve this problem.

J0002 - Out of memory

The compiler attempted to allocate some additional memory during processing, but was unable to do so. When this error occurs, check the location, size, and validity of your system swap file. Also, check that there is sufficient growth space available on the drive on which your swap file resides. This error can also occur if a source file is too large. Break your source file into smaller blocks, and then try compiling again.

J0003 - Invalid code: 'string'

The compiler may have detected generation of invalid code. Try dividing larger methods defined within your classes into smaller methods and compiling again.

J0004 - Cannot open class file 'filename' for reading

The compiler could not open the program source file for reading. This error most likely occurs when another program has an exclusive lock on the source file. Try shutting down other processes that may be accessing the source file and compiling again.

J0005 - Cannot open class file 'filename' for writing

The compiler failed to generate the output .class file. This error most likely occurs when the compiler cannot get write or create permission for the file. Make sure the file does not have its read-only attribute set, and that it is not currently in use by another process. This error can also occur when you are currently running or debugging the program that contains the specified .class file. Stop all running instances of the program and try compiling again.

J0006 - Cannot read class file 'filename'

The compiler failed to read the specified .class file. This error most likely occurs when the compiler encounters an error reading the storage device, or when the compiler cannot otherwise get read permission for the file. Check to ensure the file is not currently in use by another process. Also, use whatever means available (for example, SCANDISK) to ensure the validity of the storage device you are attempting to use.

J0007 - Cannot write class file 'filename'

The compiler failed while attempting to write the contents of a buffer to the specified .class file. This error most likely occurs when space is exhausted on the targeted storage device. Try freeing up any available space on the storage device and compiling again.

J0008 - Cannot locate class file 'filename'

The compiler could not locate a core language class for the java.lang package. This error most likely occurs when the Java CLASSPATH variable is not properly set. Try correcting the CLASSPATH variable, and compiling again.

J0009 - Not used

This error message is currently not used.

J0010 - Syntax error

The compiler could not determine the meaning of an expression or statement within the source program. This error most likely occurs when the line indicated in the error message is syntactically invalid. This error usually accompanies a more descriptive error. Try correcting any accompanying errors and compiling again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      int i =; // error: initialization error
   }
}
 

J0011 - Expected ':'

The compiler expected to find a colon following a case label or in a conditional expression that makes use of the ternary operator. This error most likely occurs when the colon is accidentally omitted. Many times this error is caused on the line previous to the line the compiler has reported the error on. Check to make sure lines that require a colon are correct, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   private int i;
   private static int x = 1;
   
   public void method1(int arg1) {
   
      switch (arg1) {
         case 1 // error: ':' omitted
            ; // do something meaningful
      }
   
      i = ( arg1 < x) ? arg1  x; // error: ':' omitted
   }
}
 

J0012 - Expected ';'

The compiler expected to find a semicolon in the position indicated by the error message. This error most likely occurs when the semicolon is accidentally omitted from the end of a statement. This error can also occur when a conditional expression is not syntactically correct. Many times this error is caused on the line previous to the line the compiler has reported the error on. Check to make sure both lines of source code have proper semicolon usage, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   private static int x = 10 // error: ';' omitted
   
   public void method1(int arg1) {
   
      for (int i = 1; i < x i++) { 
         // error: ';' omitted
         ;
      }
   }
}
 

J0013 - Expected '('

The compiler expected to find a left parenthesis in the position indicated by the error message. This error most likely occurs when the left parenthesis is accidentally omitted in any of the following situations:

  • type initializations
  • catch statements
  • parenthesized expressions
  • while loops
  • for loops
  • if-else statements
The following sample illustrates this error.

public class Simple {
   
   private int i;
   
   public void method1(int arg1, int arg2) {
   
      if arg1 < arg2) // error: '(' omitted
         i = arg1;
      else
         i = arg2;
   
   }
}
 

J0014 - Expected ')'

The compiler expected to find a right parenthesis in the position indicated by the error message. This error most likely occurs when the right parenthesis is accidentally omitted in any of the following situations:

  • type initializations
  • type casts
  • catch statements
  • parenthesized expressions
  • while loops
  • for loops
  • if-else statements
The following sample illustrates this error.

public class Simple {
   
   private int i;
   
   public void method1(int arg1, int arg2) {
   
      i = (arg1 < arg2 ? arg1 : arg2; 
      // error: ')' omitted
   }
}
 

J0015 - Expected ']'

The compiler expected to find a right square bracket in the position indicated by the error message. This error most likely occurs when the right square bracket is accidentally omitted from an array declaration. Many times this error is caused on the line previous to the line the compiler has reported the error on. Check to make sure all brackets match again.

The following sample illustrates this error.

public class Simple {
   
   private int x[ = new int[500]; // error: ']' omitted
   
}
 

J0016 - Expected '{'

The compiler expected to find a left brace in the position indicated by the error message. This error most likely occurs when the left brace is accidentally omitted from the beginning of a class declaration or method code block. Many times this error is caused on the line previous to the line the compiler has reported the error on. Check to make sure all braces match, and then compile again.

The following sample illustrates this error.

public class Simple // error: '{' omitted
   
   public void method1() {
      // do something meaningful
   }
}
 

J0017 - Expected '}'

The compiler expected to find a right brace in the position indicated by the error message. This error most likely occurs when a class or method's closing brace is not found. Many times this error is caused on the line previous to the line the compiler has reported the error on. Check to make sure all braces match, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int arr[] = {1, 2A}; 
      // error: invalid initialization
   
   }
}
 

J0018 - Expected 'while'

The compiler expected to find the keyword while in the position indicated by the error message. This error most likely occurs when a do/while loop is not syntactically correct. The correct structure for a do/while loop is:

do {
   // do something useful here
} while (condition);
 

J0019 - Expected identifier

The compiler expected to find an identifier toward the end of a class, interface, variable, or method declaration. This error most likely occurs when the type is accidentally omitted in a declaration.

The following sample illustrates this error.

public class Simple {
   
   private i;  // error: type omitted
   
}
 

J0020 - Expected 'class' or 'interface'

The compiler expected to find either class or interface used within the corresponding declaration. This error most likely occurs when the keywords are accidentally omitted from a class or interface declaration. Another possible cause of this error is unbalanced scoping braces.

The following sample illustrates this error.

public class Simple {
   
   // do something meaningful
   
}}   // error: additional '}' is the problem
 

J0021 - Expected type specifier

The compiler expected to find a type specifier in the position indicated by the error message. Other errors may accompany this error due to the missing type specifier.

The following example illustrates this error.

public class Simple {
   
   public Object o =new; //error: missing 'Object' type specifier
}

J0022 - Expected end of file

The compiler expected to encounter an end of file character, but did not. This error most likely occurs when the source file has been damaged in some way. Try visually checking the source file for obvious corruption, save any changes, and then compile again.

J0023 - Expected 'catch' or 'finally'

The compiler expected to find a catch or finally block immediately following a corresponding try block.

The following sample illustrates this error.

public class Simple {
   
   public void method1( ) {
   
      try {
         // do something meaningful
      }
   
   } // error: 'catch' or 'finally' not found
}
 

J0024 - Expected method body

The compiler expected to find a method body immediately following a method declaration. This error most likely occurs when the braces surrounding the method body are not properly balanced. This error may also occur when the method was intended to be abstract or native, but the abstract or native keyword was mistakenly omitted from the method declaration.

The following sample illustrates this error.

public abstract class Simple {
   
   public void method1( ); 
   // error: 'abstract' omitted
   
}
 

J0025 - Expected statement

The compiler expected to find a statement before the end of the current scope. This error most likely occurs when the right brace designating the end of the current scope is misplaced.

The following sample illustrates this error.

abstract class Simple {
   
   void method1() { 
   
      if (1)
      // error: a statement is required 
      // after the if statement
   }
}
 

J0026 - Expected Unicode escape sequence

The compiler expected to find a valid Unicode escape sequence. This error most likely occurs when a syntactical error is found in a Unicode escape sequence.

The following sample illustrates this error.

public class Simple {
   
   int i = \\u0032; 
   // error: '\\' not invalid 
   
}
 

J0027 - Identifier too long

The compiler detected an identifier name with a length greater than 1024 characters. Shorten the identifier name, and then compile again.

J0028 - Invalid number

The compiler detected a numeric value that the Java language is not capable of supporting. This error most likely occurs when the number specified is an amount greater than any of the Java language's primitive types can accept.

The following sample illustrates this error.

public class Simple {
   
   long i = 12345678901234567890; 
   // error: value out of range
   
}

 

J0029 - Invalid character

The compiler detected an ASCII character that could not be used in an identifier. This error most likely occurs when a class, interface, method, or variable identifier includes an invalid character.

The following sample illustrates this error.

public class Simple {
   
   private int c#; 
   // error: '#' not supported
   
}
 

J0030 - Invalid character constant

The compiler detected an attempt to assign an invalid character or character escape sequence to a variable of type char.

The following sample illustrates this error.

public class Simple {
   
   char c = '\'; 
   // error: invalid escape character
   
}
 

J0031- Invalid escape character

The compiler detected the use of an invalid escape character. This error most likely occurs when a syntactical error is found in a Unicode escape sequence.

The following sample illustrates this error.

public class Simple {
   
   int i = \u032; 
   // error: Unicode uses 4 hex digits
   int x = \u0032;
    //correct assignment of a unicode escape sequence
   
}
 

J0032 - Unterminated string constant

The compiler did not detect a terminating double-quote character at the end of a string constant. This error most likely occurs when the string terminator is accidentally omitted, or when the string constant is mistakenly divided onto multiple lines.

The following sample illustrates this error.

public class Simple {
   
   String str = "Hello
   // error: '"' and ';' omitted
   
}
 

J0033 - Unterminated comment

The compiler detected the beginning of a block comment, but did not detect a valid ending for it. This error most likely occurs when the comment terminator is accidentally omitted.

The following sample illustrates this error.

public class Simple {
   
   /* This comment block
    * does not have a valid
    * terminator
   
}
 

J0034 - Not used

This error message is currently not used.

J0035 - Initializer block must be declared 'static'

The compiler detected a modifier other than static associated with an initializer. Initializers can only use the static keyword to specify the initializer as a static initializer or no modifier to signify that the initializer is a field initializer. Remove the modifier from the initializer specified in the error message or add the static modifier to the initializer, adn then compile again.

The following sample illustrates this error.

public class Simple {
   
   static private int i;
   
   {   // error: 'static' omitted
      i = 1;
   }
}
 

J0036 - A data member cannot be 'native', 'abstract' or 'synchronized'

The compiler detected one of the modifiers previously shown used in the declaration of a variable. The modifiers synchronized and native can only be applied to method declarations. The abstract modifier can be applied to methods, classes, and interfaces.

J0037 - A method cannot be 'transient' or 'volatile'

The compiler detected one of the modifiers shown above used in the declaration of a method. The modifiers transient and volatile can only be applied to field declarations.

J0038 - 'final' members must be initialized

The compiler detected an uninitialized final variable in an interface definition. Variables declared as final in an interface definition must have their value set at declaration. Once set, the value cannot be programatically changed.

The following sample illustrates this error.

public class Simple {
   
   private final int COOL_RAD; 
   // error: must have value set
   
}
 
Note that variables declared within interfaces are implicitly defined as final or static. As such, this error also occurs when their initial values are not set at declaration.

J0039 - Not used

This error message is currently not used.

J0040 - Cannot define body for abstract/native methods

The compiler detected a method body defined immediately following the corresponding declaration of an abstract or native method. An abstract method must have its implementation code defined in a subclass. Native methods are implemented using code of a native language, such as C++.

The following sample illustrates this error.

public interface Simple {
   
   public void method1() {
      // error: must define this method body
      // in a class that implements the 
      // 'Simple' interface
   }
}
 

Note that methods declared within an interface are implicitly abstract. As such, this error will also occur when you attempt to define a method body in an interface.

J0041 - Duplicate modifier

The compiler detected a modifier used twice in a declaration. This error most likely occurs when the same modifier is mistakenly used more than once within a declaration.

The following sample illustrates this error.

public class Simple {
   
   public public void method1() { // error: 'public' used twice
      // do something meaningful
   }
}
 

J0042 - Only classes can implement interfaces

The compiler detected an interface declaration using the implements keyword. Interfaces cannot implement other interfaces. Interfaces may only be implemented by classes.

The following sample illustrates this error.

public interface Simple implements color{ 
   // error: 'Simple' cannot implement the 
   // 'color' interface
   
}
interface color {
   // do something meaningful
}
 

J0043 - Redeclaration of member 'identifier'

The compiler detected the same identifier name being declared more than once within the same scope. This error most likely occurs when a variable is mistakenly declared more than once.

The following sample illustrates this error.

public class Simple {
   private int i;
   private int i; // error: 'i' declared twice
}
 

J0044 - Cannot find definition for class 'identifier'

The compiler could not locate the definition for the specified class. This error is most likely caused by a typographical error. It may also occur when the package containing the specified class cannot be found.

The following sample illustrates this error.

public class Simple {
   
   char buf[] = new chaar[5];
   // error: 'chaar' not a valid type
   
}
 

J0045 - 'identifier' is not a class name

The compiler detected one of the following conditions:

  • A class name provided as part of an import statement could not be found or the import statement was not syntactically valid.
  • The class attempted to extend an interface.

Make sure that the package exists and that any classes that you import exist in the package specified in the import statement, and then compile again.

The following sample illustrates this error.

package non.existent;
   
import non.existent; // error: 
   
public class Simple {
   
   // do something meaningful
   
}
 

J0046 - 'identifier' is not an interface name

The compiler detected that the identifier referred to by the keyword implements is not an interface.

The following sample illustrates this error.

class Simple2 {
   
   // do something meaningful
   
}

public class Simple implements Simple2 {
   
   // error: cannot implement class 'Simple2'
   
}
 

J0047 - 'identifier' is not a package name

The compiler detected an invalid package name. This error most likely occurs when a syntactical error exists in an import statement or when the package name does not otherwise exist.

J0048 - Cannot extend final class 'identifier'

The compiler detected an attempt to subclass a class declared with the keyword final. Classes declared as final cannot be subclassed.

The following sample illustrates this error.

final class Simple2 {
   
   // do something meaningful
   
}

public class Simple extends Simple2 {
   
   // error: cannot extend 'Simple2'
   
}
 

J0049 - Undefined name 'identifer'

The compiler detected an unknown class name while processing an import statement. This error most likely occurs when the identifier is misspelled or does not exist. This error may also occur if the CLASSPATH environment variable is not set correctly.

The following sample illustrates this error.

import java.io.bogus; // error: unknown class name
   
public class Simple {
   
   // do something meaningful
   
}
 

J0050 - 'identifier' is not a member of 'identifier'

The compiler detected a reference to an identifier that is not a member of the specified package. This error most likely occurs when the identifier is misspelled or does not exist.

The following sample illustrates this error.

class Simple2{
   public void methodx(){}
}

public class Simple {
   
   public void method1() {
      Simple2 smp = new Simple2();
      smp.method2();
      // error: 'method2' not member of 'Simple2'
   }
}
 

J0051 - Undefined package 'identifier'

The compiler detected a package name, but was unable to locate the package definition. This error most likely occurs when a syntactical error exists in an import statement. This error may also occur when the package cannot be found or does not exist. Make sure the path is set in the CLASSPATH environment variable.

The following sample illustrates this error.

import java.lang.String.*;
// error: 'String' not a valid package name

public class Simple {
   
   // do something meaningful
   
}
 

J0052 - Not used

This error message is currently not used.

J0053 - Ambiguous name: 'identifier' and 'identifier'

The compiler could not resolve an ambiguity between the two identifiers shown. The error most likely occurs when the same class name occurs in two packages that are both imported into a source file using the "*" class import specifier. Make sure that you do not have two classes with the same name in the packages you are importing into your source file.

J0054 - Not used

This error message is currently not used.

J0055 - Not used

This error message is currently not used.

J0056 - Missing return type specification

The compiler detected a method declaration without a return type specified. All method declarations must specify a return type. If the method is not meant to return a value, use the void keyword.

The following sample illustrates this error.

public class Simple {
   
   public method1() { // error: no return type
   
      // do something meaningful
   }
}
 

J0057 - Class file 'identifier' doesn't contain class 'identifier'

The compiler did not detect the class name previously shown within the specified file. This error most likely occurs when the class name is either misspelled or does not exist. This error may also occur when a .class file has been renamed after successful compilation.

J0058 - Cannot have a variable of type 'void'

The compiler detected a variable declared as type void. The keyword void is not allowed in variable declarations. Rather, void can only be used as a method return type, indicating that the method does not actually return a value.

The following sample illustrates this error.

public interface Simple {
   
   public final static void i = 1; 
   // error: 'void' not valid
}
 

J0059 - Cannot reference member 'identifier' without an object

The compiler detected an attempt to reference a variable without a known object association. This error most likely occurs when an instance field or method (a field or method declared without the keyword static) is referenced from within a static method without a valid instance. Static methods cannot use instance fields and methods without a valid instance of the class.

The following sample illustrates this error.

public class Simple {
   
   private int x;
   
   public static void method1() {
   
      x = 0; // error: 'x' must be static
   }
}
 

J0060 - Invalid forward reference to member 'identifier'

The compiler detected an attempt to initialize a variable with another variable that had not yet been defined. To avoid this situation, reverse the field declarations order so that a variable that is referenced by another is defined first.

The following sample illustrates this error.

public class Simple {
   
   private static int i = j; 
   // error: 'j' not yet defined
   private static int j = 0;
}
 

J0061 - The members 'identifier' and 'identifier' differ in return type only

The compiler detected a subclass method attempting to overload a base class method, but the methods differed only in return type. In Java, overloaded methods must be distinguished by unique signatures. A unique signature consists of the method name, the number, type and positions of its parameters, and the return type.

The following sample illustrates this error.

public class Simple extends Simple2 {
   
   public void method1() {
      // error: only return type differs
   }
}

class Simple2 {
   
   public int method1() {
   
      return 1;
   }
}
 

J0062 - Attempt to reduce the access level of member 'identifier'

The compiler detected an overridden method in the class being compiled that reduces the access level of its base class method. The base class access modifier for a method must be maintained by all derived classes that want to overload the method.

J0063 - Declare the class abstract, or implement abstract member 'identifier'

The compiler detected the declaration of an abstract method within a class, but the class was not declared to be abstract.

The following sample illustrates this error.

public class Simple {
   
   public abstract void method1(); 
   // error: class not abstract
   
}
 

J0064 - Not used

This error message is currently not used.

J0065 - Cannot assign to this expression

The compiler detected an expression in the position normally held by an lvalue for assignment. This error most likely occurs when an expression is being assigned a value, but the expression is not capable of accepting the assignment.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int x = 0;
      int y = 1;
   
      x++ = y; //error: '++' not valid
   }
}
 

J0066 - 'this' can only be used in non-static methods

The compiler detected use of the keyword this within a class (or static) method. Class methods are not passed implicit this references. As such, they cannot reference instance (non-static) variables or methods.

The following sample illustrates this error.

public class Simple {
   
   int x;
   
   public static void method1() {
   
      this.x = 12; // error: 'this' instance specific
   }
}
 

J0067 - Cannot convert 'identifier' to 'identifier'

The compiler detected a variable type used out of its correct context. As such, the compiler could not implicitly convert the result to anything meaningful. Convert the value you are attempting to use to something the method or field definition requires, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int i = 10;
   
      if (i--) { 
         // error: conditional needs expression
         // or boolean variable
      }
   }
}
 

J0068 - Cannot implicitly convert 'identifier' to 'identifier'

The compiler could not convert the specified variable without an explicit typecast. The error most likely occurs when a numeric field is assigned to a data type that is not numeric. Use a typecast to convert the data type to the appropriate data type, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   int i = 10;
   
   public char method1() {
   
      return i; // error: expected type char
   }
}
 

J0069 - Cannot apply '.' operator to an operand of type 'identifier'

The compiler detected the '.' operator applied to an invalid type. This error most likely occurs when the length method is applied to an invalid type.

The following sample illustrates this error.

public class Simple {
   
   int i = 123;
   int j = i.length; // error: 'i' not an array
   
}
 

J0070 - Not used

This error message is currently not used.

J0071 - Not used

This error message is currently not used.

J0072 - 'identifier' is not a member of class 'identifier'

The compiler detected a method call, but the method remains undefined. This error most likely occurs when the method name is either misspelled or cannot be found within proper scope. This error may also occur when the method does not exist. Make sure that the member you are trying to reference exists in the specified class.

The following sample illustrates this error.

public class Simple {
   
   public static void main(String args[]) {
   
      System.out.printline("Hello");
      // error: 'printline' should be 'println'
   }
}
 

J0073 - Not used

This error message is currently not used.

J0074 - Operator cannot be applied to 'identifier' and 'identifier' values

The compiler detected an operator that cannot be correctly applied to the identifiers shown in the error message. This error most likely occurs when two fields are non-numeric and operators used for numbers are applied to the fields.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      String s1 = "one";
      String s2 = "two";
      String result;
   
      result = s1 * s2; // error: invalid operands
   }
}
 

J0075 - Invalid call

The compiler detected syntax for a method call, but the identifier does not represent a valid method name. This error most likely occurs when a method name is misspelled or contains characters that are not recognized as valid in Java naming conventions.

The following sample illustrates this error.

class Simple {
   
   int x = 1();
   //error: 1 is not a valid method name
}
 

J0076 - Too many arguments for method 'identifier'

The compiler detected a known method call, but the call contained more arguments than needed. Check the number of arguments for the method you are attempting to call, and remove any additional arguments from the call.

The following sample illustrates this error.

public class Simple {
   
   public void method1(int arg1) {
   
      // do something meaningful
   }
   
   public void method2() {
   
      method1(1, 2); // error: Too many arguments
   }
   
}
 

J0077 - Not enough arguments for method 'identifier'

The compiler detected a known method call, but the call contained fewer arguments than needed. This error most likely occurs when one or more arguments are accidentally omitted from the call.

The following sample illustrates this error.

public class Simple {
   
   public void method1(int arg1) {
      // do something meaningful
   }
   
   public void method2() {
   
      method1(); // error: Too few arguments
   }
}
 

J0078 - Class 'identifier' doesn't have a method that matches 'identifier'

The compiler identified a call to a known overloaded method within another class, but was unable to detect a matching method with the correct number of arguments. Make sure the overloaded method call has the correct number and type of arguments, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      // do something meaningful
   }

   public void method1(int arg1) {
      // do something meaningful
   }
}

class Simple2 {
   
   public void method1() {
   
      Simple s = new Simple();
      s.method1(1, 2, 3); // error: too many args
   }
}
 

J0079 - Ambiguity between 'identifier' and 'identifier'

The compiler could not distinguish the correct method to execute. This error most likely occurs when two overloaded methods have related argument lists and the method call cannot be differentiated between the two methods. Make sure your method call is not using a parameter that conflicts with another overloaded method. Another way to avoid this error is to change the argument lists of the two overloaded methods so that they have a different number of arguments or more uniquely defined parameter data types.

The following sample illustrates this error.

public class Simple {
   
   static void method1(Simple2 s2, Simple3 s3) {
      // do something meaningful
   }
   
   static void method1(Simple3 s3, Simple2 s2) {
      // do something meaningful
   }
   
   public static void main(String args[]) {
   
      Simple2 s2 = new Simple2();
      method1(s2, s2);
      // error: Ambiguity between Simple2 and Simple3
   }
}

class Simple2 extends Simple3 {
   // do something meaningful
}

class Simple3 {
   // do something meaningful
}
 

J0080 - Value for argument 'identifier' cannot be converted from 'identifier' in call to 'identifier'

The compiler detected a method argument that does not match the parameters specified in the method declaration. This error most likely occurs when a numeric field is passed as an argument to a method but the method requires a different numeric type. To pass different numeric types to arguments of a method, typecast the field being passed to method.

The following sample illustrates this error.

public class Simple {
   
   public void method1(int arg1) { 
      // do something meaningful
   }
   
   public void method2() {
   
      float f = 1.0f;
      method1(f); // error: mismatched call types
   }
}
 

J0081 - Value for argument 'identifier' cannot be converted from 'identifier' in call to 'identifier'

The compiler detected a method call, but was unable to convert one of the arguments from the supplied type to the type shown in the method declaration. This error most likely occurs when a method is called with the arguments in the wrong order or the wrong method was called.

J0082 - Class 'identifier' doesn't have a constructor that matches 'identifier'

The compiler did not detect a constructor matching the call identified in the error. This error most likely occurs when a constructor is called with the wrong number of arguments. Check to make sure that the class has a constructor that matches the one you are attempting to call.

The following sample illustrates this error.

public class Simple {

   Simple(int arg1) {
      // do something meaningful
   }

   public static void main (String args[]) {
   
      Simple s = new Simple(12, 13); 
      // error: too many arguments
   }
}
 

J0083 - 'super( )' or 'this( )' may only be called within a constructor

The compiler detected use of either the super() or this() keyword outside of a constructor. The super() keyword is used to call a superclass constructor, while the this() keyword is used to call one constructor from another. To reference methods in a base class, you must use the super keyword.

The following sample illustrates this error.

public class Simple {
   public void method1 () {
      super(); // error: 'super' cannot be called
   }
}

public class Simple{
   public method2(){
      super.method1(); //correct way to call a method of a superclass
   }
}
 

J0084 - Can't return a value from a 'void' method

The compiler detected an attempt to return a value from a method declared with a return type of void.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      return 1; // error: cannot return a value
   }
}
 

J0085 - Expected return value of type 'identifier'

The compiler detected the keyword return within the body of a method which was declared to return a specific type, but the return had no associated value. The return statement with no associated value will not return a default value and thus must be assigned a valid return value.

The following sample illustrates this error.

public class Simple {
   
   public int method1() {
      return; // error: must return int value
   }
}
 

J0086 - '[]' cannot be applied to a value of type 'identifier'

The compiler detected array brackets used with a non-array variable type. Change the field to be a valid array declaration if you wish to use the field as an array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      int i = 0;
      int j, x;
   
      x = j[i]; // error: 'j' not declared as array
   }
}
 

J0087 - The 'goto' statement is not currently supported by Java

The keyword goto, while defined as a keyword, has not yet been implemented in the Java language.

J0088 - Not used

This error message is not currently used.

J0089 - Already had 'case: 'identifier'

The compiler identified two or more case statements with the same identifier or value occurring within the same switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1(int arg1) {
   
      switch (arg1) {
         case 1:
            return (int) 1;
         case 2:
            return (int) 2;
         case 2: // error: duplicate of above
            return (int) 3;
         default:
            return (int) 0;
      }
   }
}
 

J0090 - Already had 'default'

The compiler identified two or more instances of the keyword default occurring within the same switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1(int arg1) {
   
      switch (arg1) {
         case 1:
            return (int) 1;
         case 2:
            return (int) 2;
         default:
            return (int) 3;
         default: // error: duplicate of previous
            return (int) 0;
      }
   }
}
 

J0091 - 'case' outside of switch statement

The compiler identified the keyword case used outside the scope of a switch statement.

The following sample illustrates this error.

public class Simple {
   
   public int method1() {
      case 1: // error: no switch statement
         return 1;
   }
}
 

J0092 - Constant expression expected

The compiler has detected an expression that used a nonconstant value when a constant value was required. This error most likely occurs when a variable is used in a case statement. Check the expression and make sure that a constant value is being used.

The following sample illustrates this error.

public class Simple{
   int var1 = 10;
   int var2 = 20;
   public void method1(){
      switch(var1){
        case var2:
        //error: cannot use variable with case
      }
   }
}

J0093 - 'break' only allowed in loops and switch statements

The compiler detected the keyword break occurring outside the scope of a loop or switch statement.

J0094 - Label 'identifier' not found

The compiler detected a label name associated with one of the keywords continue or break, but could not find the label. This error most likely occurs when a label does not exist yet is being referenced by a break or continue statement. The error can also occur if the label is placed outside of the break or continue statement's scope. A label cannot reference labels in other classes or other source files. Check to make sure the break or continue statement can access a valid label, and then compile again.

The following example illustrates this error.

public class Simple{
   public int method1(){
      int y;
      for (int x = 0; x < 10; x++){
         y = x *2;
         if (x == 5)
            break test; //error 'test' is not defined as a label
      }
      return y;
   }
}

The following example illustrates the proper usage of a label when used with the break or continue statements:

public class Simple{
   public int method1(){
      int y;
      for (int x = 0; x < 10; x++){
         y = x *2;
         if (x == 5)
            break test; //error 'test' is not defined as a label
      }
      test:
      return y;
   }
}

J0095 - 'continue' only allowed in loop

The compiler detected attempted use of the keyword continue outside the scope of a loop.

J0096 - Class value expected

The compiler detected a synchronization block, but the synchronized modifier was applied to an invalid type. This error most likely occurs when an identifier other than a class object instance is used with the synchronized statement.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {

      int i;

      synchronized (i);
      // error: 'i' must resolve to 
      // class or array type 
   }
}
 

J0097 - Class or array expected

The compiler detected the instanceof operator applied to a type that did not resolve to a class or array. The instanceof operator is used to determine if identifier is an instance of a specific class or array. Make sure the lvalue used with the instanceof operator references a class instance or array and the rvalue references a valid class name or array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      Simple2 obj = new Simple2();
   
      if (obj instanceof int) // error: bad type
         ; // do something meaningful
   }
}

class Simple2 {
   // do something meaningful
}
 

J0098 - Attempt to access nonexistent member of 'identifier'

The compiler detected an array member that was specified, but could not identify it. This error most likely occurs when an attempt to reference the length method of an array is mistyped. This error can also occur when an attempt is made to call a method in an array of objects, but the call does not reference an element of the array.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int j[] = new int[10];
      int i = j.bogus; 
      // error: 'bogus' not valid member
   }
}
 

J0099 - Not used

This error message is currently not used.

J0100 - Cannot throw 'identifier' - the type doesn't inherit from 'Throwable'

The compiler detected an object in a throw statement that was not derived from the class Throwable. This error most likely occurs when a throw statement uses a class that does not inherit from the Throwable class. Check to make sure that the exception class you are throwing is a valid exception class.

J0101 - The type 'identifier' does not inherit from 'Throwable'

The compiler detected an invalid class argument used as an argument in a catch declaration. When using a catch statement to handle exceptions, you must define it with a class derived from Throwable as a parameter. Make sure the class you defined for the catch statement is derived from Throwable, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      try {
         // do something meaningful
      } catch (String s) {
         // error: 'String' not a subclass
         // of 'Throwable'
      }
   }
}
 

J0102 - Handler for 'identifier' hidden by earlier handler for 'identifier'

The compiler detected an exception handler that will never be executed because an earlier handler would have already caught the exception. This error is most likely caused by putting catch statements in the wrong order.

The following sample illustrates this error.

class Simple {
   
   static
   {
      try
      {
      }
      catch (Exception e)
      {
      }
      catch (ArithmeticException e)
      {
      }
      // error: any exceptions this block
      // could have caught are already caught
      // by the first catch statement.
   }
}
 

J0103 - Cannot override final method 'identifier'

The compiler detected a class method attempting to override one of its base class methods, but the base class method was declared with the keyword final. Methods defined with the final modifier cannot be overridden by a derived class.

The following sample illustrates this error.

public class Simple extends Simple2 {
   
   public void method1() {
      // error: 'method1' final in superclass
   }
}

class Simple2 {
   
   public final void method1() {
      // do something meaningful
   }
}
 

J0104 - Unreachable statement or declaration

The compiler detected a statement or declaration that cannot be reached under any circumstances. This error most likely occurs when a return statement is called from a method and code is placed below the return statement. This error can also occur if a break statement is used in a loop without any flow control to allow code below it to be run.

The following sample illustrates this error.

class Simple {
   static
   {
      return;
      int x;
      //error: the declaration cannot be reached
   }
}
 

J0105 - Method 'identifier' must return a value

The compiler detected a method declaration, which included a return type other than void, but the keyword return was not found in the method body. This error most likely occurs when a method that returns a value is missing a valid return statement. This error can also occur if a return statement is called within a flow control block and cannot always accessed due to the logic of the method.

The following sample illustrates this error.

public class Simple {
   
   public int method1(int arg1) {
   
   } // error: expected an integer returned
}
 

J0106 - Class 'identifier' has a circular dependency

The compiler detected two or more classes directly or indirectly attempting to subclass each other. One class should act as the base class of the other.

The following sample illustrates this error.

public class Simple extends Simple2 {
   
   // error: extending 'Simple2'
}

class Simple2 extends Simple {
   
   // error: also extending 'Simple'
}
 

J0107 - Missing array dimension

The compiler detected the initialization of an array, but failed to detect a valid array dimension. This error most likely occurs when an array is defined but one of the dimensions of the array is not defined. To use an array, all dimensions must be defined.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      int [][] i = new int[][12]; 
      // error: missing first array dimension
   }
}
 

J0108 - Cannot 'new' an instance of type 'identifier'

The compiler detected an attempt to instantiate a data type that does not require use of the keyword new. This error most likely occurs when an attempt is made to use the new keyword with an intrinsic data type and the declaration is not an array. Make sure your member declaration does not use the new keyword unless it is a class object or array declaration.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
      int i = new int(5); 
      // error: cannot use 'new' on 'int' types
   }
}
 

J0109 - Cannot 'new' an instance of abstract class 'identifier'

The compiler detected an attempt to instantiate a class object declared as abstract. A class declared as abstract cannot be instantiated and exists only as a base class for other classes to derive from.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      Simple2 s2Object = new Simple2(); 
      // error: class 'Simple2' declared as abstract
   }
}

abstract class Simple2 {
   // do something meaningful
}
 

J0110 - Cannot 'new' an interface 'identifier'

The compiler detected an attempt to instantiate an interface object declared as abstract. Note that interfaces are abstract by default, regardless whether the keyword abstract is used in their declaration.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      Simple2 s2Object = new Simple2(); 
      // error: interface Simple2 is abstract
   }
}

interface Simple2 {
   // do something meaningful
}
 

J0111 - Invalid use of array initializer

The compiler detected an attempt to initialize an array, but the initialization statement was not syntactically correct. Arrays can be initialized at declaration with an initial set of values. The compiler detected that the syntax of the initialization was incorrect. This error most likely occurs when trying to initialize a multidimension array with the incorrect number or positioning of braces and commas. Check the syntax of your array initialization, and then compile again.

J0112 - Cannot assign final variable 'identifier'

The compiler detected an attempt to change the value of a variable declared as final. A field declared as final cannot be assigned a value once it has been initialized with a value either at declaration or in an initializer block.

The following sample illustrates this error.

public class Simple {
   private final int i = 3;

   public void method1(int arg1) {
      i = arg1; 
      // error: variable 'i' declared final
   }
}
 

J0113 - Call to constructor must be first in constructor

The compiler detected a constructor called from within the body of a second constructor, but the constructor call was not placed at the beginning of the second constructor body. In a constructor, calls to another constructor must be the first line of code in the constructor's body. Move the constructor call to the top, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   int i, j;
   Simple () {
   
      i = 0;
   }
   
   Simple(int arg1) {
   
      j = arg1;
      this(); // error: call to Simple() must be first
   }
}
 

J0114 - Cannot reference 'this' in constructor call

The compiler detected a reference to this in a constructor. The this statement can only be used in a constructor to access methods and fields of the constructor's class. Usage of this(this) or super(this) in a constructor will cause this error to occur because the instance of the class has not yet been created, and thus cannot be passed to another constructor.

The following sample illustrates this error.

class SuperSimple {
   
   SuperSimple(Object o) { }
}

public class Simple extends SuperSimple {
   
   Simple()
   {
      super(this);
      //error: cannot refer to this in constructor
   }
}
 

J0115 - Cannot call constructor recursively

The compiler detected a recursive constructor call. This error most likely occurs when a constructor has a call to the same constructor. This error can also occur if one constructor calls a second constructor and the second constructor has a call back to the first constructor.

The following sample illustrates this error.

public class Simple {
   
   Simple (int arg1) {
   
      this(1);
      // error: constructor calling itself
   }
}
 

J0116 - Variable 'identifier' may be used before initialization

The compiler detected an attempt to use a variable before it was properly initialized. To use a variable in an assignment or expression, you need to assign a value to it. Initialize the variable in a constructor or field initializer, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   static 
   {
      int i;
      int j = i;
      // error: 'i' not yet initialized
   
   }
}
 

J0117 - Cannot declare a class to be 'private'

The compiler detected use of the modifier private in an outer class declaration. This modifier may only be used with fields, methods, and inner class declarations.

The following sample illustrates this error.

private class Simple {
   
   // error: a class cannot be 'private'
   
}
 

J0118 - Not used

This error message is currently not used.

J0119 - Not used

This error message is currently not used.

J0120 - Divide or mod by zero

The compiler detected a division by zero error in code.

The following sample illustrates this error.

public class Simple {
   
   final int x = 0;
   int y = 1 % x;
   //error: x cannot be 0 
   
}
 

J0121 - Unable to recover from previous error(s)

The compiler encountered a serious error and could not continue processing the file reliably. Try fixing whatever errors are already flagged, and then compile again.

J0122 - Exception 'identifier' not caught or declared by 'identifier'

The compiler detected an exception that was thrown but never caught within the exception class. This error most likely occurs when a method calls another method with a declaration to throw an exception. For a method to call another method that throws an exception, the method must either be declared to throw the exception or handle the error using a try catch combination.

The following sample illustrates this error.

class SimpleException extends Exception {
   // do something meaningful
}

class Simple {
   
   void method1() throws SimpleException { }
   void method2() { method1(); } 
   // error: exception not declared for method2
}
 

J0123 - Multiple inheritance of classes is not supported

The compiler detected a class attempting to apply the keyword extends to more than one base class. This is defined as multiple inheritance in other languages and is not supported in Java.

The following sample illustrates this error.

public class Simple extends BaseClass1, BaseClass2 {
   // error: Multiple inheritance not supported in Java
}

class BaseClass1 {
   
   // do something meaningful
}

class BaseClass2 {
   
   // do something meaningful
}
 

J0124 - Operator cannot be applied to 'identifier' values

The compiler detected an operator being applied to a type it cannot be used with. Make sure the operation you are attempting is valid for the type of variable or object, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   void method1(boolean b) {
   
      b++;
      // error: post increment operator cannot
      // be applied to boolean variables
   }
}
 

J0125 - 'finally' without 'try'

The compiler detected a finally block but did not find a corresponding try statement. A finally block is used to execute code after a try statement and regardless of the results of the try statement.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      finally {
         // error: missing corresponding 'try'
      }
   }
}
 

J0126 - 'catch' without 'try'

The compiler detected a catch block but did not find a corresponding try statement. To use a catch block you must have a try statement preceding it. Make sure you have a valid try statement, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      catch {
         // error: missing corresponding 'try'
      }
   }
}
 

J0127 - 'else' without 'if'

The compiler detected the keyword else, but did not find a corresponding if statement. This error most likely occurs when there are scoping issues with regards to the placement of an else statement. This error can also occur if an else statement's corresponding if statement is missing.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
      else // error: no corresponding 'if'
         ;
   }
}
 

J0128 - Cannot declare an interface to be 'final'

The compiler detected an interface declared with the keyword final. Interfaces cannot be defined as final and thus cannot use the final modifier. Remove the final keyword from the interface's declaration, and then compile again.

The following sample illustrates this error.

final interface Simple {
   
   // error: 'final' only applies to
   // classes, methods or variables
   
}
 

J0129 - Cannot declare a class to be 'identifier' and 'identifier'

The compiler detected a class declared with modifiers that cannot be combined. Make sure that the modifiers you have applied to the class do not conflict with each other, and then make appropriate changes.

The following sample illustrates this error.

public abstract final class Simple {
   
   // error: 'abstract' and 'final' cannot
   // be used together in a class declaration
   
}
 

J0130 - Cannot declare an interface method to be 'native', 'static', 'synchronized' or 'final'

The compiler detected one of the keywords previously shown used in the declaration of an interface method. Because an interface method does not have implementation code, it cannot be declared as native, static, synchronized, or final.

The following sample illustrates this error.

interface Simple {
   
   public final void method1();
   // error: 'method1' cannot be declared 
   // as final in an interface
}
 

J0131 - Cannot declare a method to be 'identifier' and 'identifier'

The compiler detected the use of two or more incompatible modifiers in the declaration of a method. This error most likely occurs when a method has been defined with two access modifiers such as public and private. Make sure the modifiers for the method do not conflict with each other, and then make appropriate changes.

The following sample illustrates this error.

public class Simple {
   
   public private void method1() {
   
      // error: modifiers 'public' and 'private'
      // cannot be combined in a declaration
   }
}
 

J0132 - Cannot declare a field to be 'identifier' and 'identifier'

The compiler detected the use of two or more incompatible modifiers in the declaration of a variable. This error most likely occurs when a field has been defined with two access modifiers, such as public and private. Make sure the modifiers for the field do not conflict with each other, and then make appropriate changes.

The following sample illustrates this error.

public class Simple {
   
   public private int i;
   // error: modifiers 'public' and 'private' 
   // cannot be combined in a declaration
}
 

J0133 - Constructors cannot be declared 'native', 'abstract', 'static', 'synchronized', or 'final'

The compiler detected the use of one of the modifiers previously shown in the declaration of a constructor. Make sure that the constructor is not defined with any of the modifiers mentioned in the error message, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   final Simple() {}
   // error: constructors cannot be 'final'
   
}
 

J0134 - Interfaces cannot have constructors

The compiler detected an interface containing a constructor declaration. Because an interface cannot be instantiated, constructors are not allowed to be defined for an interface. If you are defining a method with the same name as the method, make sure that it has appropriate modifiers to differentiate it from a constructor declaration.

The following sample illustrates this error.

interface Simple {
   
   Simple();
   // error: interfaces cannot 
   // declare constructors
   
}
 

J0135 - Interface data members cannot be declared 'transient', 'volatile', 'private', or 'protected'

The compiler detected one of the modifiers previously shown used in the declaration of a interface member variable.

The following sample illustrates this error.

interface Simple {
   
   volatile int i = 1;
   // error: 'volatile'cannot be used.
   
}
 

J0136 - Public class 'identifier' should not be defined in 'identifier'

The compiler detected more than one class declared with the modifier public in a source file. Remove the public access modifier from the other classes, and make sure that the class that will be exposed through the class file is declared as public. You can also move classes that need to remain declared as public to their own source file.

The following sample illustrates this error.

public class Simple {
   
   // do something meaningful
   
}

public class Errorclass {
   
   // error: only one class may be defined as 
   // 'public' within the same source file
   
}
 

J0137 - Not used

This error message is currently not used.

J0138 - Interface cannot have static initializer

The compiler detected a static initializer within an interface. Because an interface does not get instantiated, initializers cannot be defined in an interface. To set the values of interface fields, initialize them at the time of declaration.

The following sample illustrates this error.

interface Simple {
   
   static {
      // error: static initializers cannot 
      // be used in interfaces
   }
   
}
 

J0139 - Invalid label

The compiler detected an invalid label. Labels must start with an alphanumeric character. Change the label, and then compile again.

The following sample illustrates this error.

public class Simple {
   
   public void method1() {
   
   123:
   // error: label cannot 
   // begin with alphanumeric
   
   return;
   
   }
}
 

J0140 - Cannot override static method 'identifier'

The compiler detected an attempt to override a static method from within a subclass. A method that has been declared as static cannot be overridden.

The following sample illustrates this error.

public class Simple {
   
   static void method1() {}
}

class SimpleSubclass extends Simple {
   
   void method1() {}
   // error: cannot override 
   // static method
}
 

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 filename

The compiler detected the @ character on the JVC command line, but did not detect a valid response filename immediately following it. Supply the response filename, 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.

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.

J0181 - Not used

This error message is currently not used.

J0182 - Not used

This error message is currently not used.

J0183 - Not used

This error message is currently not used.

J0184 - Not used

This error message is currently not used.

J0185 - Not used

This error message is currently not used.

J0186 - Not used

This error message is currently not used.

J0187 - Not used

This error message is currently not used.

J0188 - Not used

This error message is currently not used.

J0189 - 'return' not allowed in a static initializer or instance initializer

A return statement was found in a static initializer. Initializers, like constructors, cannot return a value. Remove the return statement, and then compile again.

The following sample illustrates this error.

public class Simple{
   
   static int var1;
   
   static{
   
   var1 = 0;
   return; // Error, static initializer cannot use the
           // return statement.
   
   }
}
 

J0190 - Not used

This error message is currently not used.

J0191 - Expected '.class'

The compiler detected usage of an intrinsic type name in an assignment statement but did not find .class after the name. This error most often occurs when the .class keyword was omitted. Make the appropriate changes to the statement, and then compile again.

The following sample illustrates this error.

public class Simple{
   public static void main (String args[]){
      Class x = int;//error: missing '.class'
   }
}
 

J0192 - '.class' on intrinsic type requires Java 1.1 compatible class libraries

The compiler has detected usage of .class with an intrinsic data type, but either the Microsoft Win 32 VM for Java or the Java class libraries are based on Java 1.0. Make sure that your class libraries and Java VM are the Java 1.1 versions, and then compile again.

J0193 - Cannot have an array of type 'void'

An attempt to define an array of type void was found by the compiler. The void data type is for use with methods to declare the method has no return value and thus cannot be used as an array.

J0194 - class or interface cannot be declared 'volatile', 'native', 'transient', or 'synchronized'

The compiler detected that an inner class has been declared with one of the above mentioned modifiers. Inner classes can only use the private, public, protected, and static modifiers.

The following example illustrates this error.

public class Simple{
   //Do something here
   volatile class InnerClass{
      /*error: like outer class, inner classes cannot be defined as
               volatile */
   }
}
 

J0195 - Cannot declare 'identifier' as 'static' in inner class 'identifier'

The compiler detected an attempt to declare a variable or method as static from within an inner class. Unlike regular class declarations, inner classes do not support static members unless the inner class has been declared static. This error can also occur if an interface was defined within an inner class.

The following example illustrates this error.

public class Simple{
   
   //Do something meaningful here
   
   class InnerClass{
   
   static int var1; /* error: cannot declare static
                              members in inner class */
   }
}
 

J0196 - Nested class 'identifier' cannot have the same name as any of its enclosing classes

The specified inner class has the same name as one of the classes that it is nested under. Make sure you have not duplicated the name of a class that your inner class is nested in.

The following example illustrates this error.

public class Simple{
   
   // Do something meaningful here
   class InnerClass{
      //Do something meaningful here
        class Simple{
            //error: inner class has same name as a parent class
        }
   }
}
 

J0197 - Cannot declare interface in inner class 'identifier'.

The compiler detected an attempt to declare an interface inside an inner class. Inner class definitions do not support interfaces declared within them.

The following example illustrates this error.

public class Simple{
   //Do something meaningful here
   class InnerClass{
   //Do something meaningful here
      interface MyInterface{
         /*error: interfaces cannot be declared
                  inside inner classes */
      }
   }
}
 

J0198 - An enclosing instance of type 'identifier' is required

The compiler detected that an inner class definition has tried to reference something outside of its scope. Examples of when this can occur are:

  • A static inner class definition referenced one of the parent class's variables. Because the inner class is declared static, it cannot reference any members of the parent class without an instance of the parent class defined.
  • An inner class tried to reference a class that was not its outer class using the this keyword with the classes name preceding it. Since the referenced class it not the inner class's parent class, an instance cannot be implied.

The following example illustrates this error.

//This example illustrates the first error situation
public class Simple{
   int x = 10;
   static class InnerClass{
      public void method1(){
         int y = x; /*error: instance variable needed
                             to reference parent
                             variables. */
      }
   }
}

//This example illustrates the second error situation
class A{
   int x;
}
class B{
   //Do something meaningful here
   class InnerClass{
      void method1(){
         int y = A.this.x;
         /*error: no instance of A defined. Cannot use
           the <classname.this.variable> syntax here.*/
      }
   }
}
 

J0199 - Call of 'this()' cannot be qualified

The compiler detected that an inner class's constructor attempted to call a constructor from its outer class using the class name and this(). Inner classes cannot call their outer class's constructors.

The following example illustrates this error.

public class Simple{
   int x;
   Simple(int x){
      this.x = x;
   }
   class InnerClass{
      InnerClass(){
         Simple.this(10);
         //error: cannot call outer class constructor
      }
   }
}
 

J0200 - 'this' must be qualified with a class name

The compiler detected that an attempt was made in an inner class to reference an outer class member using the this keyword with a name other than an outer class's name. Only the name of the outer class can be used from an inner class to reference members of the outer class.

The following example illustrates this error.

public class Simple{
   int x;
   class InnerClass{
      void method1(){
         int j = x.this;
         /*error: only a class name can be used with
         this to reference outer class */
      }
   }
}
 

J0201 - 'super' cannot be qualified except as a superclass constructor call

The compiler detected the usage of the super keyword with an instance of the superclass preceding it to access a field or method of the superclass. Using an instance of a superclass along with the keyword super is limited to referencing a superclass constructor when the superclass has inner classes defined.

J0202 - 'super()' cannot be qualified; superclass 'identifier' is not an inner class

The compiler has detected a call to a superclass constructor using an instance of the superclass but the superclass is not an inner class. The usage of an instance of a superclass with the super keyword is only valid when the superclass is an inner class.

The following example illustrates this error.

class Simple{
   //Do something meaningful here
}

class NotSimple extends Simple
{
   NotSimple(Simple smp){
      smp.super();
      /*error: cannot call 'super' with instance when
        superclass does not contain inner classes*/
   }
}
 

J0203 - Cannot access protected member 'identifier' in class 'identifier' from class 'identifier'

The compiler has detected an attempt to access a protected member from a class in a different package. Classes that reside in separate packages cannot refer to protected members unless you are subclassing a class in the other package.

J0204 - Cannot access protected member 'identifier' in class 'identifier' through a qualifier of type 'identifier'

The compiler detected that a class in one package that is extending a class in another package, attempted to access a protected member of the base class using an instance of the base class. This error most likely occurs when a class attempts to access members of its base class through an instance other than this or super.

J0205 - Cannot use non-final local variable 'identifier' from a different method

The compiler detected that a local variable, which was not declared as final, was referenced in a method. This error can occur if an inner class is defined in a method declaration and the inner class attempts to reference a parameter or local variable passed to the method.

The following example illustrates this error.

public class Simple{
   void method1(int var1){
      class InnerClass{
         boolean getVar1(){
           return(var1 == 1);
           /*error cannot reference local variable of
                   method from within inner class. */
         }
      }
   }
}
 

J0206 - Cannot assign a second value to blank final variable 'identifier'

The compiler detected an attempt to assign a value to a final variable more than once. This error most likely occurs when a blank final variable is initialized more than once in constructor or initializer. Check for duplicate initializations of the final variable mentioned in the error message, and then compile again.

J0207 - Cannot assign blank final variable 'identifier' in a loop

The compiler detected that a final variable was assigned a value from within the scope of a program control loop. A final variable can only be assigned a value once and thus cannot be initialized within a loop. Move the initialization of the final variable specified in the error message outside of the loop and ensure that it is initialized only once.

The following example illustrates this error.

public class Simple{
   final int x;
   
   public Simple(){
      for (int z=0;z<10;z++){
         x = z; /*error: cannot assign final variable
                  in loop */
      }
   }
}
 

J0208 - Constructor or instance initializer must assign a value to blank final variable 'identifier'

The compiler detected that a final variable was declared but never assigned a value in either an initializer or constructor. For a variable to be properly declared final, it must be assigned a value.

J0209 - Expected '='

The compiler detected that an "=" was missing from a comment tag (for example @com, @security, @dll) attribute. This error most often occurs when an equal sign is missing from an attribute in a comment tag declaration. This error could also occur if another symbol or character obscures the "=" sign from being evaluated by the compiler. Check to make sure all comment tag attributes have proper "=" signs applied, and then compile again.

The following example illustrates this error.

/**@com.interface(iid 31415926-5358-9793-2384-612345678901)*/
//error: missing equal sign in 'iid' parameter
interface Itest{
   //Do something meaningful here
}
 

J0210 - Expected '.'

The compiler detected that the specified comment tag's declaration (for example @com) is missing a period (.) after the comment tag. This error can also occur if another symbol or character obscures the period symbol from being evaluated by the compiler. Check to make sure your comment tag declaration contains a period after the comment tag, and then compile again.

The following example illustrates this error.

/**@com class*/
//error: missing '.' from @com statement

public class Simple{
   //Do something meaningful here
}
 

J0211 - Not used

This error message is currently not used.

J0212 - Not used

This error message is currently not used.

J0213 - Not used

This error message is currently not used.

J0214 - Invalid GUID specified

The compiler detected that an @com attribute that uses a GUID was incorrect. This can be caused by a syntax error in entering the GUID. Check the syntax for the GUID, and then compile again.

J0215 - Syntax error in @com declaration

A syntax error was found in the specified @com declaration. This is most often caused by incorrectly typing the declaration. Check the syntax of the @com declaration, and then compile again.

J0216 - @com attribute 'identifier' on 'identifier' is illegal in this context

The compiler has detected that a value assigned to an attribute within an @com declaration is illegal. This error most often occurs when an attribute is specified but usage of the attribute requires that other specific attributes be specified. This error can also occur if an attribute is specified in the wrong location within an @com declaration. The following list illustrates some examples of when this can occur.

  • The @com.parameter attribute iid can only be specified if the attribute type has a value of either "OBJECT" or "DISPATCH".
  • The @com.parameter attribute size can only be specified if the type attribute is specified as either "ARRAY", "STRUCT", "SYSFIXEDSTRING", or "FIXEDARRAY".
  • The @com.method attribute name2 can only be specified if the method is declared within an @com.interface declaration that has its type attribute equal to either dual or dispatch.
  • The @com.parameter attribute name cannot be specified as the last attribute in an @com.parameter declaration.

J0217 - @com attribute 'identifier' was not specified for 'identifier' but is required in this context

The compiler has detected an attribute for the @com declaration shown in the error is missing, and is required for this type of declaration. Each type of @com declaration has attributes that are required. Check the documentation on @com for more details on what attributes are required for the @com declaration that is listed in the error message.

The following example illustrates this error.

/**@com.class() */
//error: must specify iid for @com.class
public class Simple{
   //Do something here
}
 

J0218 - @com attribute 'identifier' on 'identifier' has an invalid value

The compiler has detected that the value specified in the error message is either not the correct type for the attribute specified in the error or is outside the valid ranges for the error. Check the value assigned to the specified attribute, and then compile again.

J0219 - An @com attribute cannot be placed on member 'identifier' unless the containing class also has an @com attribute

The compiler has detected that an @com declaration was placed on a member of a class or interface but the class or interface was not declared with an @com declaration. Check to make sure the class or interface that contains the method specified in the error has a valid @com declaration defined.

The following example illustrates this error.

interface Simple{
   /**@com.method(dispid=777) */
   public void method1();
   /*error: interface does not have an @com comment tag
            assigned*/
}
 

J0220 - An @com attribute cannot be placed on static member 'identifier'

The compiler detected that an @com declaration was placed on a static member of a class. Static members cannot be exposed through COM. Remove the static keyword from the method or field, and then compile again.

J0221 - The @com attribute on member 'identifier' cannot be used in this kind of class or interface

The compiler has detected that an @com declaration was placed on a member of a class or method but because of the type of @com declaration used with the class or interface, it is not allowed. This error can occur in the following situations:

  • Using an @com.structmap declaration on a member of a class or interface that has the @com.class or @com.interface declaration applied.
  • Using an @com.method declaration on a member of a class that has the @com.struct declaration applied.

The following example illustrates this error.

/**@com.struct()*/
class Simple{
   /**@com.method(dispid=777)*/
   public native void method1();
   /*error: cannot use @com.method inside of
            @com.struct*/
}
 

J0222 - @com attribute cannot be placed on method 'identifier'-- it must be declared 'native' or be in an interface

The compiler has detected that a method was specified with an @com.method or @com.parameters declaration but the method was not declared with the native modifier or declared in an interface definition. For methods to be exposed through a COM interface, they must be either declared native from within a class declaration or be declared in an interface declaration.

J0223 - The @com.parameters declaration on member 'identifier' has the wrong number of parameters

The compiler has detected that the @com.parameters declaration, specified in the error message, has a different number of parameters than the method it is exposing through COM. Make sure that both the method's declaration and the @com.parameters declaration have the correct number of parameters, and then compile again.

The following example illustrates this error.

/**@com.interface(iid=31415926-5358-9793-2384-612345678910)*/
interface Itest{
   /** @com.method(dispid=306)
       @com.parameters([type=BOOLEAN] var1, var2, var3)
   */
   public void method1(boolean var1, int var2);
   /*error: extra parameter added to com.parameters
            declaration */
}
 

J0224 - 'return' must be the last item in an @com.parameters declaration

When declaring @com.parameters for a method, the return parameter must be the last parameter in the list. The compiler has detected the return parameter in a different position within the parameter list. Check the location of the return parameter in the @com.paramters declaration specified in the error message, make appropriate changes, and then compile again.

J0225 - An @com.'identifier' declaration is illegal for this kind of item

The compiler detected that an @com declaration was defined for the wrong type of item. This error most likely occurs as a result of a change to your code but not to the syntax or placement of an @com declaration. Make sure the proper @com declaration is used on the specified item in your code.

The following example illustrates this error.

/**@com.interface(iid=31415926-5358-9793-2384-612345678901,dual)*/
interface Itest{
   /**@com.struct()*/
   public int method1();
   //error: wrong type of @com attribute applied
}
 

J0226 - The @com declared type of 'identifier' is illegal for a dispatch or a dual interface

The compiler detected that an @com interface declaration, declared as either a dual or dispatch interface, has a member that contains an @com.parameters declaration with an incorrect type. Certain @com.parameters types are not allowed when the interface they are defined in is declared as either dual or dispatch interface. The following list shows which values are invalid for type.

  • FIXEDARRAY
  • SYSFIXEDSTRING
  • I8
  • U8
  • STRUCT
  • CUSTOM, CUSTOMBYREF/CUSTOMBYVAL
  • PTR (except PTR to VARIANT)
  • Arrays of any of the previously listed values.

J0227 - It is impossible for an expression of type 'identifier' to be an instance of 'identifier'

The compiler has detected that a comparison of two classes using the instanceof operator could never be instances of each other. To use the instanceof operator correctly, you must be comparing classes that have some common class lineage. Either change the expression containing the instanceof operator so that it uses a related class and instance for its comparison, or remove the expression, and then compile again.

The following example illustrates this error.

class Simple1{
   //do something meaningful here
}

class Simple2{
   //do something meaningful here
}

class CompClasses{
   Simple1 x = new Simple1();
   public static void main(String args[]){
   
   if(smp.x instanceof Simple2){
      /*error: nonrelated classes cannot be instances of each other*/
   }
}
 

J0228 - Syntax error in @dll declaration

The compiler has detected a syntax error in an @dll statement. This error most likely occurs when an @dll statement has been mistyped. Check the statement for syntactical errors, and then compile again.

J0229 - Expected string constant

The compiler detected a parameter of a comment tag's declaration (for example @com, @dll, or @security) that was expecting a string constant, was either missing it or it was incorrectly entered. This error most often occurs when matching quotes are missing around a value passed to an attribute. Check your comment tag declaration's attributes, and then compile again.

The following example illustrates this error.

/**@com.interface(iid=31415926-5358-9793-2384-612345678901,dual)*/
interface ITest{
   /**@com.method(name=method1);*/
   //error: Missing quotes around 'method1'
   public void method1();
}
 

J0230 - Class or interface name 'identifier' conflicts with import 'identifier'

The specified class or interface conflicts with a class that has been imported. This could be caused by declaring a class or interface that is already declared in the Java API and you are importing that API class or interface into your source file.

J0231 - Expression statement must be assignment, method call, increment, decrement, or 'new'

The compiler has detected an invalid expression statement. An expression statement is a statement that can reside on its own line of source code. The following are some examples of valid expression statements.

Method calls
m_cars.changeColor();
Assignment statements
int x = y + z;
Increment statement
j++;
m_tempVar1 += 3;
Use of the new keyword
new Simple();

The following are examples of invalid expression statements.

1+2;
Error: No assignment statement
j+k-method1();
A method call but not a valid assignment statement
var1 == var2;
Comparison statements should be contained in flow control statements

J0232 - Expected '{' or ';'

The compiler has detected an error with a method declaration in a class or interface. This error most likely occurs if an interface's method declaration is missing a semicolon at the end of the declaration or a class's declaration is missing its opening brace '{'. Check the specified class or interface method declaration and check for a missing semicolon or opening brace, and then compile again.

J0233 - Catch clause is unreachable; exception 'identifier' is never thrown in the corresponding try block

The compiler detected that the specified catch clause will never be executed because the corresponding try statement never throws the catch statement's exception type. Catch statements are required to catch exceptions or derivations of exceptions that the try statement can throw. This error can be avoided by changing the catch statement so it does not catch a specific exception type but catches the base Exception class. Change the exception class so that your catch statement will trap it, and then compile again.

J0234 - 'identifier' is not a field in class 'identifier'

The compiler detected a field reference but the field does not exist in the specified class. This error most likely occurs when the field reference is mistyped or the field reference was meant to reference a field in a different class. Make sure that the field exists in the specified class and that your reference to the field is syntactically correct, and then compile again.

J0235 - 'identifier' is not a method in class 'identifier'

The compiler detected a method call but the method does not exist in the specified class. This error most likely occurs when the method call is called incorrectly or the method call was meant to reference a method in a different class. Make sure that the method exists in the specified class and that your method call is syntactically correct.

J0236 - 'identifier' is not a nested class or interface in class 'identifier'

The compiler has detected a reference to a nested class or interface but the nested class or interface does not exist in the specified class. This error most likely occurs because of a syntactical error in referencing a nested class or interface. Check the reference to the inner class for syntax errors and make sure that the class or interface exists inside the specified class, and then compile again.

The following example illustrates this error.

class NotSimple{
}

public class Simple{
   void method1(){
      NotSimple nt = new NotSimple();
      Object o = nt.new InnerClass();
      //error: 'InnerClass' is not an inner class of 'NotSimple'
   }
}
 

J0237 - 'identifier' is not a field or nested class in class 'identifier'

The compiler has detected a reference to a nested class or field but the nested class or field does not exist in the specified class. This error most likely occurs because of a syntactical error in referencing a nested class or field. This error can also occur if a reference to a field in an inner class is made but the field does not exist within the inner class definition. Check to make sure the inner class or field exists, and then compile again.

J0238 - Cannot throw exception 'identifier' from field initializer

The compiler has detected that an exception was thrown within a field initializer. This error most likely occurs when an exception can be thrown from a constructor of a class, and an instance of that class is declared and instantiated as a member of another class. To resolve this problem, have the class object that throws the exception instantiated inside a constructor so it can use a try and catch combination to trap any exceptions from the other class's constructor call.

The following example illustrates this error.

public class Simple{
   public int i;
   public Simple(boolean var1) throws Exception{
      if (var1 = true)
         i = 0;
      else
         throw new Exception();
   }
}
//This is the incorrect way to instantiate this class
class Simple2{
   Simple smp = new Simple(true);
   /* error: cannot call constructor that throws exception in field
            initializer*/
}
 

J0239 - Static initializer must assign a value to blank final variable 'identifier'

The compiler detected that a static final variable was not initialized to a value using a static or field initializer. To declare a variable as static and final, you must use a static or field initializer to set an initial value. This error can also occur if a field is declared as static and final and assigned a value in a constructor.

The following example illustrates this error.

public class Simple{
   static final int MAX_CONTROL;
} //error: static final variables must have value assigned
 

J0240 - Syntax error in @security declaration

The compiler detected a syntax error in the specified @security comment tag. This error most likely occurs when the comment tag is missing a closing parenthesis or the tag's attributes are incorrect. Check the syntax of the specified @security comment tag declaration, and then compile again.

The following example illustrates this error.

/**@security()*/   //error: invalid @security syntax
public class Simple{
   //Class members defined here
}
 

J0241 - '@security' can only be specified on a class or interface

The compiler detected that the @security comment tag was applied to something other than a class or interface declaration. @security comment tags are used to define the security settings for a class or interface definition and cannot be applied to methods or fields of a class or interface.

J0242 - Cannot make static call to nonstatic method 'identifier'

The compiler has detected that a method was called by using the static method call syntax of '<classname>.<method>', but the method is not a static method. Change the method call to use an instance of the class that contains the method instead of the class name itself, and then compile again.

J5001 - Local variable 'identifier' is initialized but never used

The compiler detected an initialized variable that was never referenced in any class code. This message occurs at warning level 3 or greater.

The following sample illustrates this warning.

public class Simple {
   
   public int method1() {
   
      int i = 1;
      return 1;
      // warning: 'i' is never used
   }
}
 

J5002 - Compiler option 'identifier' is not supported

The compiler that detected an unsupported command line option was specified. Check your compiler switch settings, and then try compiling again.

J5003 - Ignoring unknown compiler option 'identifier'

The compiler detected an unknown option specified on the Jvc command line. This warning most likely occurs when a typographical error exists. For example, specifying /W4 on the command line will cause this warning because the warning level option must use a lowercase 'w'.

J5004 - Missing argument for compiler option 'identifier'

The compiler detected a valid command line option, but the required argument was not specified. Check your compiler switch settings and try compiling again.

J5005 - Package 'identifier' was already implicitly imported

The compiler detected an import statement for a package that was already implicitly imported, such as java.lang. This message occurs at warning level 1 or greater.

J5006 - 'private protected' not supported, using 'protected'

The compiler detected use of the modifier combination private protected. This combination is now obsolete and has been replaced by protected. This message occurs at warning level 1 or greater.

J5007 - Not used

This error message is currently not used.

J5008 - Not used

This error message is currently not used.

J5009 - Not used

This error message is currently not used.

J5010 - Not used

This error message is currently not used.

J5011 - Not used

This error message is currently not used.

J5012 - Not used

This error message is currently not used.

J5013 - Not used

This error message is currently not used.

J5014 - 'identifier' has been deprecated by the author of 'identifier'

The method or class referenced has been marked as deprecated. Deprecated methods or classes are marked by the creator of the source code as outdated and subject to removal. To keep code stable, avoid calling functions that have been flagged as deprecated.

J5015 - The parameter 'identifier' in an @com.parameters declaration does not match the corresponding argument 'identifier'

A COM interface parameter declaration does not match the method that implements the interface. This error could indicate inconsistent data types or mismatched of parameter locations.

The following sample illustrates this warning.

/** @com.interface(iid=31415926-5358-9793-2384-612345678901, dual) */
interface ExampleInterface 
{
/** 
@com.method(dispid=306)
@com.parameters([type=BOOLEAN] when, on) 
*/
public String Method1(boolean on, int when); //Error, on and when
                                             // have changed order. 
}
 

J5016 - This 'instanceof' operator will always be true

The compiler determined that the specified instanceof expression will always evaluate to true. This could occur when instanceof is used to determine if a subclass instance is a member of a base class or an implemented interface. Although it is not an error to use the operator in this way, it is not useful because the expression will always evaluate to true.

The following sample illustrates this warning.

interface I {}
class X {}
class Y extends X implements I {}

public class Simple{
   void f()
   {
      Y y = new Y();
      X x = new X();
      Object o;

      // These statements result in J5016 warnings.
      if (y instanceof X){
         // y is of type Y, which extends X, so this is always true
      }
      if (y instanceof I){
         // type Y implements I, so this is always true.
      }
      if (x instanceof Object){
         // everything is of type Object
      }
   }
}
 


Top © 1998 Microsoft Corporation. All rights reserved. Terms of use.