Microsoft SDK for Java

J0001–J0020

J0001 J0002 J0003
J0004 J0005 J0006
J0007 J0008 J0009
J0010 J0011 J0012
J0013 J0014 J0015
J0016 J0017 J0018
J0019 J0020  

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 'file name' 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 'file name' 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 'file name'

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 'file name'

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 'file name'

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 environment 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:

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:

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

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