Java Glossary : error messages

CMP home Java glossary home Menu no menu Last updated 2004-07-02 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : E words : error messages.

error messages
The error messages that the Java compilers and runtime produce are cryptic and the true source of the error can be far from the technical problem the compiler is pointing at.

A compiler looks at source code from quite a different perspective that humans do. You gradually get to know what your compiler really means when it says baffling things like "{ expected."

Sometimes a single syntax error starts off an avalanche of baffling compiler error messages. As a general rule, look slightly earlier or later of where the compiler is complaining. Fix any problems there and recompile. Most of the time the other errors will disappear.

I repeat, don't waste time trying to figure out arcane messages. Correct what you can and recompile. Most of the time the arcane ones will mysteriously disappear.

When you start using a compiler, it is a good idea to deliberately make some common errors, and see what the compiler says. Then you can make a table to help you later when you inadvertently make that error. (That is how I created many of the entries in the table below.)

When you make an error, get a baffling error message, and eventually figure out what it means, make a note to yourself to help in future when that error message appears again. (That is largely how I created the table below.)

It also helps to have two or three compilers on tap. When you get a really baffling error message, try some other compilers. With three variants on the error message, you have extra clues what it really means. Jikes in particular offers additional insight since its error messages are quite different from Sun's. Conversely, if you use Jikes, Sun's messages can be enlightening.

This table was constructed merging error messages from several compilers including Symantec Visual Café, IBM Visual Age, IBM Jikes, JBuilder 3 and various Sun JDKs. Please submit baffling messages from your favourite compiler. I also include run-time messages.

I make no attempt to keep track of which error messages came from which compilers. Take all advice with a grain of salt. There are many possible causes for any given error message. I would hope this is obvious, but only one of my listed conditions needs to be met for the error to occur, not all of them. Further, the appearance of an error message is no guarantee that any of the listed conditions apply. These are just hints as to what might be the matter.

Another general hint is to delete all class files and recompile. Sometimes the problem is caused by references to renamed or discontinued code. Until the class files are removed, references to them are still valid. You may be getting the old code instead of the new.

Don't sweat every error message. When you correct some, the strange ones often mysteriously disappear. Only the authors of the compiler have any hope of understanding the chain of causality. Just fix what you can and recompile. If you have Jikes, you can fix just two three errors before recompiling in the hopes many cascaded errors will disappear.

For totally mysterious errors, look at your source code file with a hex viewer. There may be code way off screen to the right. There may be strange control characters embedded in your file.

If you don't find the puzzling error message in this table, you can do two things:

  1. Ask me via email, showing me the code and the error message.
  2. Look up the message in a search engine, particularly Google. There is a good chance somebody has asked about it in a newsgroup at some time and received a public reply. Google has the Deja newsgroup archives indexed.
Please share your discoveries with the world by emailing your findings via email so I can merge them into this table.

If you first don't find the error message. Skim the entire table for it. I may have filed it differently from the way you would. Use your browser find feature to look for key words in your error message. There is no totally obvious order in which to file them. It might be worth your while just to scan the entire list every once is a while to refresh your memory on what is in there.

Index To ErrorMessages

. expected ClassFormatError not a statement
.class expected ClassNotFoundException not accessible
; expected ConcurrentModificationException not found in import
; missing constructor calls overrridden method not initialised
= expected constructor used as method NotSerializableException
AccessControlException Could not find main-class NTLDR missing
already defined does not contain expected NullPointerException
ambiguous class duplicate class NumberFormatException
Applet not inited duplicate methods operator +
ArithmeticException: EOFException in ZIP operator ||
array not initialised Exception never thrown package does not exist
ArrayIndexOutOfBoundsException ExceptionInInitializerError Pong
ArrayStoreException identifier expected possible loss of precision
attempt to reference illegal nonvirtual public class should be in file
attempt to rename illegal start return in constructor
bad class file IllegalAccessError return required
bad magic number Image won't paint security violation
bad major impotent setters should be declared in file
blank Applet incompatible type signal 10 error
blank final IncompatibleClassChangeError StackOverflowError
boolean dereferenced instance not accessible statement expected
can't access class intern overflow static not valid on constructor
can't be applied invalid declaration StreamCorruptedException
can't be dereferenced invalid flag StringIndexOutOfBoundsException
can't be instantiated; invalid label superclass not found
can't create virtual machine invalid method suspcious shadowing
can't determine application home invalid type TrustProxy
can't instantiate abstract class InvalidClassException type can't be private
can't make static reference JavaMail obsolete type expected
cannot override load: class not found unable to load for debugging
cannot override main must be static void Unable to open file xxx.exe
cannot resolve constructor method cannot hide unable to run
cannot resolve symbol method matches constructor name undefined variable
cannot resolve symbol constructor Thread method not found unexpected symbols
cannot resolve symbol this misplaced construct UnmarshalException
cannot use operator new misplaced package unreported exception
capitalisation errors missing init UnsatisfiedLinkError
case fallthru missing method body unsorted switch
clashes with package missing public UnsupportedDataTypeException
class file contains wrong class name of constructor mismatch VerifyError
class must be defined in a file no field void type
class not found no method found weaker access
class not found in import no method matching wrong name
class not found in type declaration NoClassDefFoundError wrong version
class or interface declaration expected non-final variable ZipException
class or interface expected non-static can't be referenced { expected
class should be declared in file NoSuchMethodError } expected
ClassCastException NoSuchProviderException  

Compiler Error Messages

Compiler Error Messages
Key What Compiler / Runtime Says Real Error / Possible Causes
. expected '.' expected. Usually pointing to an import statement. You must import either a packagename.* or packagename.classname. You can't just import packagename or import classname. You don't import classes in the same package. In other words, the thing you import will always contain at least one . You don't use import for code is not in any package. You have to put such code directly on the classpath..
.class expected '.class' expected you wrote int i where you meant just plain i.
; expected semicolon expected.
  • Usually this is just a missing semicolon,
  • sometimes it can be caused by unbalanced () on the previous line.
  • sometimes it can be cause by junk on the previous line. This junk might be far to the right off the screen.
  • Sometimes it is caused by spelling the keyword if incorrectly nearby.
  • Sometimes it is a missing + concatentation operator.
; missing ';' expected. 'else' without if. statement expected. invalid expression. missing semicolon
= expected = expected. Look for a stray } just before where it is complaining.
AccessControlException AccessControlException This usually happens in unsigned Applets when you attempt to do something Applets are not allowed to do, such as read a file or talk to a server other than the one you were loaded from. You are getting slapped down by the security sandbox. However, they also occur in other contexts you would not think would be related to security, e.g. in RMI when you have a mangled serialised object, or if you try to register a duplicate RMI service name. There is a bug in the Bea JVM that fails to give permission for getClassLoader even when you ask for AllPermissions.

One common way to get in trouble is to use absolute URLs in your unsigned Applet. The Applet will then work on one website only, or locally only. Instead, use a relative URL and convert it to an absolute one like this:

URL url = new URL( absoluteOrRelativeUrlString );

if ( url.getProtocol().length() == 0 )
   {
   // convert relative URL to absolute
   url = new URL ( getDocumentBase(), url.getPath() );
   }

already defined Variable 'x' is already defined in this method. duplicate variable declaration
ambiguous class ambiguous class x.y.SomeClass and a.b.SomeClass,
reference to Object is ambiguous, both class org.omg.CORBA.Object in org.omg.CORBA and class java.lang.Object in java.lang match.
import x.y.SomeClass;
import a.b.SomeClass;
can be changed to:
import x.y.*;
import a.b.*;
Some compilers may complain about the clash in SomeClass, even if you never reference it. And of course all references to Someclass should be disambiguated to either x.y.SomeClass or a.b.Someclass. Alternatively, you can throw out all the imports, and fully qualify all classes in x.y and a.b. This approach makes code easier to maintain, because it is easier to find the code that implements the class when it is fully qualified. In your own classes, try to use globally unique class names. Even if the computer understands the ambiguity, humans often become confused.
Applet not inited Applet not inited (sic) Missing package statement. These erroneous Applets will often work with the Java Plug-in, or when run locally, but will fail with native Javas when run on the web. There can also be problems with your jar file having too much or too little qualification of class names. Your <APPLET CODE= must have nothing but the classname, without the .class. Make sure the case and name exactly match the name of the *.java file, *.class file, and class name. For a class in a package this would have dots in it, e.g. com.mindprod.mypackage.Myclass, but it would not have any directory qualification. Your CODEBASE= parameters must have an absolute http://-style reference to the base directory where the code is stored. For a local hard disk, the only thing I could get to work reliably on NT with all browsers and Appletviewers is leaving the CODEBASE out entirely. You may find for your platform you have to code it something like this: ///C|//MyDir/ or C:\MyDir\. Your ARCHIVE= parameter must have a list of the jar files, separated by commas. If you have too little or too much qualification, or if you fail to use the file naming conventions of your server, you will be in trouble.
ArithmeticException: ArithmeticException: / by zero You divided by 0. If it occurred in a paint method, likely this occurred as a result of creating a Font with zero height.
array not initialised Array a may not have been initialized. You forgot to initialise an array with new int[5].
ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException You have used an array index outside the allowable range. There may be several array references x[i] in the same line. Don't leap to conclusions about which one caused the trouble. Arrays are indexed from 0 to x.length-1, not 1 to x.length the way FØRTRAN programers are used to. When you allocate the array you specify the length something like this:

int[] x = new int[10];

ArrayStoreException ArrayStoreException The rules of casting arrays and casting the elements of arrays are subtle. See the gotchas.
attempt to reference Attempt to reference method xxx in class XXX as an instance variable. missing dummy pair of parentheses after the 0-argument method name.
attempt to rename jarsigner: attempt to rename xxx.jar to xxx.jar.orig failed. Your jar is in use by some running Applet or application. Shut it down to build and sign the jar.  
bad class file bad class file: XXX.java file does not contain class XXX. Please remove or make sure it appears in the correct subdirectory of the classpath. Check that the package statement and the class statement have names that are precisely correct including case, and that this file is in a directory that precisely matches the package name and the source file name that precisely matches the class name followed by .java.
bad magic number Bad magic number The first four bytes of a class file are supposed to say CAFEBABE in hex. They don't.
  • Most likely the problem is you uploaded your class file to your Web server using FTP ASCII mode instead of BINARY mode which mangled the class file.
  • There is a bug in the class library. Sometimes when a class is not found it gets reported as corrupt instead.
  • Novices get this error when they try to run a program without compiling it first e.g
    java.exe MyClass.java
    
  • If the class file seems ok, consider the possibilty some other class file on the classpath is the one the classloader is looking at.

bad major Bad major version number Most likely your class files use a more recent version of Java than the Java runtime you are using. This most commonly happens with Applets in Internet Explorer which supports only an ancient version of Java.
blank Applet Applet works fine run as application, but shows a blank screen without any error message when run as an Applet. There is not even an Applet loading message. Check the <applet code="com.mindprod.mypackage.Myclass.class" tag. It is spelled code not class.
blank final Blank final variable 'xxxx' may not have been initialized. It must be assigned a value in an initializer, or in every constructor. Check that your final variable is indeed so initialised. If it is, remove the final, to bypass a bug in the Javac 1.1 compiler.
boolean dereferenced boolean cannot be dereferenced. You need extra layers of parentheses around your casting.
can't access class Can't access com.mindprod.mypackage.MyClass. Only classes and interfaces in other packages can be accessed.
  • You forgot to make the class public.
  • In JBuilder, check the properties for your project. Your root directories should be plain C:\ not C:\com\mindprod\thepackage
can't be applied setVisible(boolean) in java.awt.Component cannot be applied to () You wrote x.setVisible() instead of x.setVisible( true ).
can't be dereferenced int cannot be dereferenced. You need extra layers of parentheses around your casting. or perhaps you may have written something like i.toString() where i is an int rather than an object with methods. You need to write something like Integer.toString(i) instead. Ints can't have any instance methods. They can be parameters to either static or instance methods though.
can't be instantiated; load: com.mindprod.mypackage.MyApplet.class can't be instantiated. java.lang.InstantiationException: com/mindprod/mypackage/MyApplet You are missing the default constructor for your Applet. See the section earlier in the gotchas on The Case of the Disappearing Constructor.
can't create virtual machine Could not create the Java virtual machine You wrote java -xxxx.jar instead of java -jar xxxx.jar
can't determine application home Can't determine application home. Uninstall all Java JDKs and JREs with the control panel. Use Microsoft's RegClean. Tidy up the registry with regedit. Reinstall just the latest JDK.
can't instantiate abstract class Error: MyClass is an abstract class. It can't be instantiated. missing method to fulfill an interface implementation
can't make static reference Can't make a static reference to nonstatic variable x in MyClass. using an instance variable in a static method
cannot override toString() in xxxx cannot override toString() in java.lang.Object; attempting to assign weaker access privileges; was public. You can override a default or protected method with a public one, but not the reverse.
cannot override toString() in xxxx cannot override toString() in java.lang.Object; overridden method does not throw java.io.IOException Overridden methods cannot add any throws clauses not in the base method they are overriding.
cannot resolve constructor Cannot resolve constructor xxx(). If a subclasses constructor does not call one of the constructors of the superclass as the very first thing, java inserts a call to the default constructor for you super(). If you have not defined that null constructor, you will get an error. The usual way to fix it is by inserting some sort of super( parm ); as the first statement of your subclass constructor. See also hints on resolving symbols.
cannot resolve symbol Cannot resolve symbol
  • No such variable or method. Perhaps it exists, but not in the current scope, e.g. you are trying to use a variable defined inside a loop outside that loop.
  • Possibly you are trying to use a constructor without new as if it were an ordinary method.
  • You left off the () on your method call.
  • If the error message is pointing to code that uses the standard classes, chances are you either misspelled it, or forgot to import the class, or misspelled the import. If it is pointing to one of your methods or variables chances are you misspelled it either in the definition or reference. Java is picky. You must get upper-lower case precisely correct too.
  • If the code is pointing to one of your classes that is clearly there, perhaps you forgot to put c:\ on the classpath -- the mother of all packages where com is in com.mindprod.thispackage lives. If you are not using packages, perhaps you forgot to put . on your classpath. A symptom of this is you can compile successfully if you rebuild everything, but not if you just recompile the changed modules.
  • You are using method of the object when the reference is to an interface that does not contain that method. Either cast to specific object, or change the reference to a specific object reference. e.g.

    FileNameFilter f = new MultiFilter();
    f.addNever( never );
    
    // should read
    FileNameFilter f = new MultiFilter();
    ((MultiFilter)f).addNever( never );
    
    // or more efficiently
    MultiFilter f = new MultiFilter();
    f.addNever( never );
    

    addNever is a method of MultiFilter, but not of FileNameFilter.

  • Watch for subtle spelling differences between declaration and reference, e.g. Hashtable and HashTable. Copy/paste the definition on top of the reference to be sure they are absolutely identical. Your eyes can fool you.
  • In an implements clause, you may have used a period where you should have used a comma.
  • If is complaining about the superclass of your constructor, the problem is you must either explicitly call super(), or there must be a superclass constructor with a matching signature.
cannot resolve symbol constructor Thread cannot resolve symbol constructor Thread( YourRunnable ) You forgot to write implements Runnable on the class with the run method.
cannot resolve symbol this Cannot resolve symbol this.xxx You are inside an anonymous inner class and xxx is a member or method of the enclosing class. You must use Outer.this. xxx instead of this.xxx.
cannot use operator new Cannot use operator new for this type You can't instantiate references, class names as Strings, interfaces or abstract classes, only concrete class names. Perhaps there is no suitable constructor. Perhaps you inadvertently wrote methods instead of constructors by specifying a return type on them.
clashes with package XXXX clashes with package of same name Rename your class or rename your package so they don't have the same name. Usually this is not a problem since package names normally have dots in them.
class file contains wrong class class file contains wrong class. Please remove or make sure it appears in the correct subdirectory of the classpath. If the name of your class is HelloWorld then the name of the source file must be HelloWorld.java, and case matters. You also get this error if you have the wrong or missing package statement. You could also have the source file in the wrong directory if you have a complex package structure. If your package is called com.mindprod.com.mindprod.mypackage and your class MyClass, then you had better be in the root directory and the class file for MyClass hand better be called MyClass.class and better live in com/mindprod/mypackage, with matching case!
class must be defined in a file Warning: Public MyClass must be defined in a file called 'MyClass.java'.
  • class name does not match source filename.
  • Putting more than one public class per file.
  • Getting the capitalisation wrong in the filename on the javac command line or in the filename itself.
class not found Class not found This can occur at compile or run time.
  • Some other syntax error ahead of the class declaration is preventing the compiler from seeing the class declaration.
  • The class is not in the proper file in the proper directory.
  • The class is not public.
  • The class does not have the correct case, either in the class name or the file name.
  • The corresponding class or java file is not on the CLASSPATH (considering the package name.)
class not found in import class com.mindprod.mypackage.Myclass not found in an import All class files and packages you reference in import statements must be accessible via the CLASSPATH, or be part of the project.
class not found in type declaration Class WindowAdapter not found in type declaration. You forgot to import java.awt.event.* or to fully qualify java.awt.event.WindowAdapter. I'm sure you can generalise for other classes.
class or interface declaration expected Class or interface declaration expected.
  • Put your package statement before all the imports. The imports come before your class declarations.
  • Make your class public, not protected.
  • You may have too many } so that you have finished off your class before you intended too. Using a source code beautifier that aligns code block and {} will help make these sorts of errors obvious.
class or interface expected 'class' or 'interface' expected There is a missing { somewhere much earlier in the code.
class should be declared in file class XXXX is public, should be declared in a file named XXXX.java The name of the *.java file must precisely match the name of the public class it defines. The name is case sensitive.
ClassCastException ClassCastException If it occurs during a sort, changes are you forgot the implements Comparable. See the gotchas for more help.

If you write a factory method like this:

protected CameraButton cameraButtonFactory ( int buttonNumber )
   {
   return new LabelledCameraButton ( buttonNumber, this );
   }

and it seems to be producing the wrong kind of objects -- ones from the base class's version of the method, check the precise spelling and signature of the method. It had better exactly match the one in the base class. If it does not exactly match, it will not override. To guard against this error Bali proposes an explicit overrides keyword.

ClassFormatError ClassFormatError
  • You mangled the class file FTP upload by doing it as ASCII instead of binary.
  • Further your web server must be configured to send *.class files as binary rather than ASCII. It needs a MIME configuration entry to define *.class files. See MIME for details.
  • Sometimes it is actually a CLASSPATH problem. It can't find the class.
  • ClassFormatError: class already loaded. You have a class file twice on the classpath. It has nothing to do with the DLL already being loaded. Thankfully, having a DLL still loaded from the last time you ran is not considered an error.
  • ClassFormatError: bad major version. Your ancient 1.1 Java runtime does not know what to do with a program compiled under JDK 1.4..
ClassNotFoundException ClassNotFoundException This occurs only at run time. Usually it means a class that was present during compilation has disappeared, or the classpath has changed so it is no longer accessible. It could also happen if you dynamically load a class and the class is not on the classpath.

Are you spelling the fully qualified class name correctly on your Applet tag. Case matters. Double check the case of every letter.

The class itself references another class that can't be found. Are you using APIs from versions of Java that aren't supported by your browser?

Try specifying CODEBASE="." as an Applet parameter, to ensure that the browser is looking in the right place.

Are there packages involved? If so, the Applet class needs to be in a package-appropriate subdirectory, or better still in a jar, not in the same directory as the HTML file. If not, you ought to look into putting every class in a some package before you deploy code; the default (nameless) package is intended only for test code that won't be distributed.

Look at your jar with winzip. Are all the classes and package names correct with the correct case? Make sure all the case information is perfect on your jar-building line.

ConcurrentModificationException ConcurrentModificationException You tried to delete or add to a Collection while you were in the middle of running an Iterator over it. To get around this, you must remove elements via the Iterator object using Iterator.remove rather than the usual Collection.remove.
Could not find main-class Could not find main-class com.mindprod.setclock.SetClock in http://www.mindprod.com/setclock.jar Check that you have the correct package name and class name in the Java source, in the *.mft file and the *.jnlp file line <application-desc main-class="com.mindprod.setclock.SetClock" />
does not contain expected myClass.class does not contain myClass as expected, but MyClass. Please remove the file. Class myClass not found in new.
  • missing caps on new MyClass() reference.
  • missing caps on MyClass() obj declaration.
duplicate class Duplicate class You misspelled the package name on the package statement. It must match the name of the directory containing the Java source.
duplicate methods duplicate method declaration You have two methods with the same name and the same signature i.e. number and types of parameters. You can't have two methods that differ only in return type.
EOFException in ZIP java.io.EOFException: Unexpected end of ZLIB input stream Try using ZipFile instead of ZipInputStream to read a zip created by ZipOutputStream. See Zip for why.
Exception never thrown Exception IOException is never thrown in the body of the corresponding try statement. You are trying to catch an exception that could never happen. Just remove the try/catch. Java does not like you trying to catch an exception that could never happen, but oddly it does not mind you declaring a throws that could never happen.
ExceptionInInitializerError ExceptionInInitializerError If you get this error when you run in Netscape, but not when debugging, check that all your class files are being included in the jar file.
identifier expected identifier expected Look for a missing { slightly before of where it is complaining. It may also be a } before the code that should appear after.
illegal nonvirtual Illegal use of nonvirtual function call An inner class is not permitted to call private methods of the enclosing outer class. It is permitted to call protected methods. This error message appears in Symantec 2.5a only when you have debugging turned off.
illegal start illegal start of expression
  • The error message will point to perfectly good code. Look just ahead of it for a missing } or ;
  • static int x = 0; Static variables have to be defined outside all methods inside a class.
  • you wrote x + = 2; instead of x += 2;
  • you wrote case: STRAWBERRY instead of case STRAWBERRY :
IllegalAccessError IllegalAccessError
  • In Netscape, inner classes can't seem to access private variables of the enclosing class. You don't discover this until run time.
  • Failing to use both the <APPLET ARCHIVE= parameter to specify a comma-delimited list of jar file names and the CODEBASE= parameter in the form of an absolute http://-style reference to where the jar file is.
  • Generally problems with CLASSPATH, CODEBASE, and ARCHIVE.
  • Classes in jar have the wrong amount of qualification stored with them.
  • Classes in packages are not stored in the correspondingly named directories. See CLASSPATH and java.exe in the Java glossary for a fuller discussion.
  • Using an old library with new code. In the old library a method might be private where in the new it might be public.
Image won't paint Your app uses drawImage, paintComponent or simply Container.add. Yet nothing appears. See the list of possible causes.
incompatible type Incompatible type for =. Explicit cast needed to convert int to byte. missing a cast such as (byte)
IncompatibleClassChangeError IncompatibleClassChangeError
  • You forgot the static on your main method.
  • Any illegal use of a legal class.
  • You have made a change to a class and are still referencing it from an another class by its old signatures. Try deleting all class files and recompiling everything.
instance not accessible Error: An instance of "XXX.this" is not accessible here because it would have to cross a static region in the intervening type "XXX". Something is wrong with the parameters to an inner class.
intern overflow OutOfMemoryError: string intern table overflow You have too many interned strings. Some older JVM's may limit you to 64K Strings, which leaves perhaps 50,000 for your application.
invalid declaration Invalid declaration Most likely the name you are trying to declare is invalid. It must not contain dots. It must not start with a digit.
invalid label invalid label You used a semicolon instead of a colon after a label.
invalid flag javac: invalid flag: MyClass writing javac.exe MyClass or javac.exe MyClass.class instead of javac.exe MyClass.java.
invalid method Invalid method declaration; return type required. forgetting void return type on a method declaration.
invalid type Invalid type expression. You forgot the semicolon.
InvalidClassException java.io.InvalidClassException: local class incompatible: stream classdesc serialVersionUID = -3714695503693357733.
  • You serialised some objects, then modified the class source code a tad, say by adding another convenience constructor. Java panicked and decided the old objects were no longer compatible when you tried to read them back in. You can soothe it by manually assigning your objects class version numbers with code like this:

    static final long serialVersionUID = 99999999999999L;
    

    It is up to you to change that number any time the class changes in a way that would affect the old object's ability to be read back with the new class definition. Java has some flexibility for the old and new objects not to have a perfect match. serialVersionUID is a magic variable name. Spell it exactly like that. If you have used a serialVersionUID, perhaps you have actually changed the layout of the class fields without a new serialVersionUID. Finally, perhaps you failed to provide a no-arg constructor.

  • You serialised some objects, then changed the format of the objects, rightly changed the serialVersionUID, then tried to read the old object back with the new class definition.
IOException IOException: invalid header field
  • Something went wrong with I/O, usually you got the filename wrong or presumed the wrong default directory.
  • If you get it in jar.exe, your manifest is malformed.
    Main-Class: com.mindprod.canadiantax.CanadianTaxCalculator
    Note, there is no space before the colon and exactly one afterwards. There must be a line feed at the end of the line. There is no .class on the end.
JavaMail obsolete You have an obsolete JavaMail or Java Activation Framework jar. Make sure you don't have more that one mail.jar or jmf.jar on the classpath/ext directory.
load: class not found load: class X not found Likely you are using Microsoft's ancient old JVM in Internet Explorer that supports only up to Java 1.1.4. Check which version of Java you are using with Wassup. Make sure you are using the most recent JRE in C:\Program Files\Java\j2re1.4.2_04.
main must be static void main must be static and void An application's main class must have a method public static void main (String[] args). Under Project Option Main Class, you must declare the name of that class, without a terminating .class.
method cannot hide The static method XXX declared in class AAA cannot hide the instance method of the same signature declared in class BBB. It is illegal to hide an instance method. You can't use the same name for a static and instance method in a subclass. Either you have to give them different names, or make them both static or make them both instance, or change the signature (parameter types) to make them different.
method matches constructor name The name of this method XXX matches the name of the containing class. However, the method is not a constructor since its declarator is qualified with a type.' You can't put void on a constructor, or put any other return type for that matter.
method not found Method MyClass() not found in MyClass
  • undefined (missing) method.
  • You wrote MyClass x = MyClass(); instead of MyClass x = new MyClass();
misplaced construct misplaced construct
  • You wrote doSomething( String[] choices ) rather than doSomething( choices )
  • There is a stray } just before of where it is complaining.
misplaced package Error: "com/sun/java/swing/xxxx" is either a misplaced package name or a non-existent entity. Sun renamed com.sun.java.swing to javax.swing but your code is still using the old name. Use a global search and replace on all your *.java files.
missing method body missing method body, or declare abstract You inserted a semicolon just before the first { of a method.
name of constructor mismatch The name of the constructor "main" does not match name of class "MyClass" You forgot your return type, e.g. void, on a method.
no field No field named "length" was found in type "java/lang/String" You said s.length rather than s.length() to get the length of a String. The a.length form without the () is only used for arrays. Whereas Lists (e.g. ArrayLists) use List.length(). Collections use Collection.size() just to keep you on your toes. You will even see getLength() every once in a while. The designers of Java must hate newbies to put such stumbling blocks in front of them. It is either laziness of a subtle form of one upmanship.
no method found No method xxx found in class yyy. You have the wrong number of parameters or the wrong parameter types for the method. It can also mean you defined a method with the wrong visibility modifier, e.g. none, private or protected when you meant public. Perhaps you called it as if it were static and defined it as instance, or vice versa. Perhaps you were calling a constructor without new.
no method matching No method matching myMethod() found in MyClass You have the wrong number of parameters or the wrong parameter types for the method. It can also mean you defined a method with the wrong visibility modifier, e.g. none, private or protected when you meant public. Perhaps you called it as if it were static and defined it as instance, or vice versa. Perhaps you were calling a constructor without new.
cap missing no warning. caps missing.
  • missing caps on a class name declaration.
  • Caps on a variable/method declaration
impotent setters no warning. impotent setters.
  • this.x = x; Effectively you wrote this.x = this.x; because there is no x parameter.
  • // This method does nothing,
    // just sets this.brush to itself.
    // Note misspelling brash for brush.
    // No warning!
    public voidsetBrush ( int brash )
       {
       this.brush = brush;
       }
    

missing public no warning. missing public. In debug mode, if you forget to make your main method public, you will not be warned. You won't discover the problem until later. main must be public static void.
case fall thru no warning. Case fall through is the default. missing break. In Java 1.4+ you can use the javac.exe -Xswitchcheck to get this error detected.
missing initialisation no warning. Missing initialisation.
  • The array is automatically initialised to null. This will likely soon lead to a java.lang.NullPointerException when you try to apply some method to one of the elements of the array. Note Null PointerException, not NullReferenceException. You forgot to initialise an array of strings or objects to some value.
  • You forgot to initialise an int array to some value or populate it with objects.
constructor treated as method no warning. Constructor treated as a method. specifying a void return type on a constructor. Method with the same name as the class.
suspicious shadowing no warning. reusing instance variable as local. You accidentally declared a local variable with the same name as an instance or class variable when you intended to use the instance or local variable. This is my most common error that the compiler does not detect. The Jikes compiler will warn you of this.
calling overridden methods in constuctor no warning. calling overridden methods in constructors Be very careful calling any methods inside your constructors. If subclasses override them, you will be invoking the subclass's version, which may be attempting to use fields that have not been initialised yet. You won't get a warning message! The problem usually shows up as puzzling NullPointerExceptions. The way out is to move code out of the constructor, often to the addNotify method. However, addNotify can get in analogous problem to the constructor since it too is overridden, and it may use overridden methods.
NoClassDefFoundError NoClassDefFoundError java.lang.NoClassDefFoundError: mypackage/MyClass scream

This one is a bitch to track down. It has so many causes. Java so picky! A misplaced comma, quote, semicolon, extraneous extension or even the wrong upper/lower case can derail the whole program. I hope some will implement the NoClassDefFound Amanuensis to make the problem easier to track down.

  • Java can't find the class mentioned. It is missing from the jar or classpath. Java may need it because it occurs as a class or superclass in a serialised ObjectStream or because you called a method of that class. You don't find out right away. You only find out when you actually go to use that class.
  • You must put the -classpath option before the class name on the java command line. To remember the order, you can think of it like this. Java.exe needs to know the classpath before it can search for the class.
  • Most commonly you are trying to use a program compiled under Java 1.4.1 with a Java 1.1.5 runtime, often the one in Internet Explorer. The old class library is missing many of the new methods.
  • You got package name wrong at the top of the source file, or left it out entirely. It does not match the one when you built the jar. It is case sensitive.
  • Make sure you said java.exe MyClass or java.exe MyClass.java not java.exe MyClass.class.
  • If this is an Applet, you got the <applet code="com.mindprod.mypackage.MyClass.class" wrong. Perhaps you forgot the package part of the name or you forgot the .class. The package names in the jar may not be right. The <applet archive="myjar.jar" may not match a jar file containing the needed class.
  • You compiled with Javac 1.4 but ran with Java 1.3 and used some new class only available in Java 1.4. Check with

    java.exe -version
    

  • If you use java.exe -jar, it ignores your classpath environment variable and any -classpath option without comment! All your classes must be in the jar. This means for example:

    java.exe -cp c:\javamail-1.2\mail.jar -jar bulk.jar
    

    won't be able to find any of the classes in mail.jar. You must copy mail.jar to the ext directory or mention the mail.jar in the manifest Class-Path: entry.

  • Did you remember to include . on your classpath?
  • If you got it trying to execute a class in a jar, check with winzip that the pathnames inside the jar on that class match the package structure. If you don't know what I am talking about, see jar for details. Make sure the class you are trying to call has the expected package statement. Check the manifest to make sure the fully qualified name of the main-class is properly specified.
  • Have you got a simple HelloWorld working yet? If not, your problem may be in the way you installed the JDK or JRE. If you have trouble, read up on Getting Started, javac.exe, java.exe and classpath.
  • Java is case sensitive. Have you got the name of the class spelled exactly the same way everywhere it is used, including the name of the *.java file, always starting with a capital letter?
  • One of your static initialisers invokes a function that uses a static not yet initialised.
  • If you have classes included in your project that don't live in the same directory as the project. In Café you must also do a Project | Options | Directory | Classes to include their directories in the invisible CLASSPATH for the project. Simply including the java or class files in the project is not sufficient.
  • Did you remember to make your kickoff class, the one you mentioned in the java command line, public?
  • Does your main method have signature exactly like this?

    public static void main( String[] args )
       {
       }
    

  • Somehow your runtime is having trouble finding classes it could find at compile time. Check your CLASSPATH. Make sure all the classes are available.
  • Check your java.exe command line. Your current directory is crucial. You must specify fully qualified class names, without the .class extension.
  • Consider combining class files in to a single jar file.
  • Check that your browser supports jar files.
  • You can get this error if you try to run a JDK 1.1 Applet on a 1.0 browser since it does not have the 1.1 classes.
  • Watch \ and /. In string literals \ appears as \\.
  • Make sure when developing classes for an extension i.e. class or jar files that live in the lib/ext/ folder, make sure you do not have duplicate classes. Classes from extension folders will always be loaded before any other classpath, therefore making it impossible to test other development versions not in the extensions folder. Make sure extensions *.jar's are complete (i.e., not reliant any additional classes). Make sure the *.jar in the extensions folder is up to date. Basically only thoroughly-tested, stable code should live in the extensions folder.
  • Have you accidentally used a system package name for your classes?
  • If every program gives NoClassDefFoundErrors this, try uninstalling all Java tools and JDKs, clean out the registry, and then reinstall. Make sure you have only the latest Java on your machine.
    JDK
  • Check your classpath. Make sure you used semicolons or colons as appropriate. Don't specify null fields in your classpath, e.g. two semicolons in a row.
  • If your NoClassDefFoundError occurs only sporadically, here is a possible cause: You are running some classes in a jar file which is stored on a network mapped drive in MS Windows. Sun keeps the jar files open in order to re-load classes which haven't been used in a while, and occasional network problems will force the jar to close. The JVM doesn't know to re-open the jar when the network mapped drive reconnects, and simply reports that various classes (different each time) no longer exist. The solution is either make sure the network is reliable, use a network file system which doesn't close if drives are temporarily unavailable, or locate all jar files on local drives.
  • If you change the jars used by your JSP code, make sure you manually delete the generated class files (classes in the WEB-INF tree for Caucho Resin). The womb won't be smart enough to do that on its own and you will get all manner of NoClassDefFoundErrors.
non-final variable Attempt to use a non-final variable i from a different method. From enclosing blocks, only final local variables are available. Inside anonymous classes, you can't use local variables of the enclosing method unless they are final.
non-static can't be referenced non-static method xxx cannot be referenced from a static context
  • You used an instance method without an object, e.g. MyClass.xxx(). You must first create an object with MyClass o = new MyClass();, then use o.xxx(); to invoke the method.
  • You used an instance variable (one without the static attribute) inside a static method. Static methods don't have access to any particular object, so can't use any of the instance (per object) fields. You may have used a reference to an inner class inside a static method. Make that inner class an ordinary separate class. Inner classes are always linked to an instance of the main class. You may have tried to instantiate an inner class in some static code. You need to make the inner class static to be able to use it without a mother object.
NoSuchMethodError NoSuchMethodError Did you remember to compile? Try del *.class; javac *.java. Did you use a Java 1.3 method with a Java 1.1 runtime? If it is complaining about the main method, it must have this exact signature.

public static void main( String[] args )
   {
   }

NoSuchProviderException javax.mail.NoSuchProviderException Use Transport.sendMessage not Transport.send.
not a statement Not a statement
  • The compiler was expecting a statement and you gave it something else. e.g. you wrote if (i > 7) 42;
  • Perhaps you used == instead of = in an assignment statement, turning it into an expression instead of a statement.
  • you wrote x + = 2; instead of x += 2;
  • Perhaps you had a stray semicolon in a statement made of dozen of concatentations.
not accessible xxx.this is not accessible here because it would have to cross a static region in the intervening type. Move your named inner class definition outside a static method. Keep in mind, instances of inner classes must be associated with an instance of the main class. As a corollary of this, you can't create anonymous inner classes except inside instance methods.
not found in import not found in import. The package you mentioned is not available on the classpath. Make sure you spell it with proper case. Make sure you understand the limitations of import wildcards. See import, classpath.
not initialised Variable x may not have been initialized. missing initialisation for a temporary variable. If you initialise it in a try block, you need also to initialise it in the catch or before the try in case you get an exception.
NotSerializableException NotSerializableException You forgot to put implements Serializable on the class you are doing a writeObject on. Since writeObject also writes out all the objects pointed to by that object, by the objects those objects point to, ad infintum, all those classes too must be marked implements Serializable. Any references to non-serializable classes must be marked transient. While you are at it, give each of those classes an explicit version number.

static final long serialVersionUID = 99999999999999L;

NTLDR missing NTLDR is missing
  • You are trying to boot from a non-system diskette (or disk) in Windows 95/98/ME/NT/2000/XP.
  • The crucial loader program used in booting has been deleted from your hard disk.
NullPointerException NullPointerException A reference variable is null.

Examine the stack trace to figure out where in the code it happening. That gives you a clue to get started. You can put some code of the form:

if ( p == null ) System.out.println("p was null" );

to narrow it down to the precise variable giving the trouble. Then you have to sit and think about why that variable is null. The real problem could be much earlier in the code, and the problem propagated through to the point where it eventually surfaced as an exception. You must figure out where it was supposed to be set, and have a look at that code and why it is failing. Most of the time you simply forgot to initialise. The easiest way to track the causes down is using a source lever debugger such as Visual Café or JBuilder. You can trace the flow of execution, or examine the state of the universe at the time of failure. If you don't have one, pepper your code with assertions to track down just what is null, e.g.

ensureNotNull(thing, "thing");

Your ensureNotNull method might print an error message if thing is null, then throw a new NullPointerException. By making ensureNotNull final, and using an if (debug) inside ensureNotNull, the inline expansions will have no overhead in production, and you can leave the debugging assertions in place to be reactivated later if ever needed.

  • Most commonly you forgot statements of the form: myArray = new int[10]; or myThing = new Thing(); See the array initialisation gotchas. These are the most common of runtime errors.
  • You may not call getParameter in the Applet constructor. Move that code to init.
  • Beware having two variable with the same name, one local and one instance, It is very easy to do inadvertently, and Javac will not warn you, though Jikes will e.g.

    ArrayList thelist = new ArrayList( 149 );
    

    instead of

    thelist = new ArrayList( 149 );
    

    You work with the local variable thinking you are working with the instance variable, and poof, your values are lost as soon as the local goes out of scope, leaving the instance version null. This is the way I most commonly create NullPointer exceptions for myself, when I convert a local variable to an instance one when I have to break a method up that uses the variable and forget to take out the local declaration.

  • Be very careful calling any methods inside your constructors. If subclasses override them, you will be invoking the subclass's version, which may be attempting to use fields that have not been initialised yet. You won't get a warning message! The problem usually shows up as puzzling NullPointerExceptions. The way out is to move code out of the constructor, often to the addNotify method. However, addNotify can get in analogous problem to the constructor since it too is overridden, and it may use overridden methods.
NumberFormatException NumberFormatException The usual problem is leading or trailing spaces on your number. The sign must come ahead of the number, no commas. Localisation may have an effect on what constitutes a valid number.
operator + operator + cannot be applied java.lang.String Irritatingly, Java does not allow unary + in front of a String, only between Strings so you can't write things like:
result =
+ "cow "
+ "rabbit "
+ "horse ";
operator || operator || cannot be applied to int,int you wrote if ( x1 = x2 || y1 = y2 ) instead of if ( x1 == x2 || y1 == y2 )
package does not exist Package Java.Applet does not exist.
  • Java is case sensitive. The package is called java.applet, not Java.Applet. Package names are supposed to be pure lower case.
  • Check that the package is available on the classpath or in some jar in the appropriate ext directory. You can use winzip to examine the jar file directories to find out which classes they contain. To help discover which jar does contain your class use google on the package name + jar. Then get that jar on the classpath or in the ext directory.
Pong Pong sound IBM Visual Age sometimes makes a noise like an elevator arriving every time you click anything. No error message is visible anywhere. It means you are debugging a multi-thread program and a higher priority thread is blocking the one you want to debug.
possible loss of precision possible loss of precision You did something like i = d; where i is an int, and d is a double. Narrowing will throw away high order bits or the fraction. You need an explicit cast to acknowledge this loss, e.g. i = (int)d;
public class should be in file Public class Xxx should be in a file named Xxx.java. JavaDoc.exe is particularly picky about case. Make sure the name of the class exactly matches the name of the file, and that the name of the package exactly matches the name of the directory tree, e.g. com.mindprod.mypackage.MyClass should be in a file called com\mindprod\mypackage\MyClass.java or com/mindprod/mypackage/MyClass.java, exactly including case of the directory names.
return in constructor 'return' with value from constructor: MyClass(..). specifying a return this in a constructor
return required Return required at end of MyClass Myclass(..). specifying a MyClass return type on a constructor
security violation No error while developing. Security Violation in production. Applets can only access the server they were loaded from.
should be declared in file Could not find the main class. Program will exit. There is a problem with the Main-Class entry of manifest in the jar file. Possibly you got the package name wrong or the case of the name off. The Main-Class must exist in an element of the jar filed under the package name as the folder. Possible the Class you specified is missing a public static void main(Strings[] args) method. Check the gotchas in setting up the manifest.
signal 10 error Unexpected Signal : 10 Signal 10 is a bus error. It's generally caused by attempting to perform an unaligned bus operation (for example, reading a long from an odd address), so it isn't something that will normally occur in a pure java application unless theres a bug in the JVM. If you have native code in your application though, that could be the cause. On some platforms, an application will get a bus error if its executable file or one of its shared libraries are replaced while the application is running.
StackOverflowError StackOverflowError These usually happen when you have recursion, a method that calls itself, perhaps indirectly via a second method. You have simply nested to deeply.
statement expected Statement expected. missing } in a method
static not valid on constructor static is not a valid constructor modifier You forgot your return type e.g. void, on a method.
StreamCorruptedException StreamCorruptedException The object stream is scrambled. Perhaps you are trying to read human-readable data, e.g. something that was not prepared with writeObject. Perhaps you have classes missing or the classes used in the stream are obsolete.
StringIndexOutOfBoundsException java.lang.StringIndexOutOfBoundsException: String index out of range The parameters you gave to the substring (or related) method were outside the range of the base string, or the start point was after the end point. See substring gotchas.
superclass not found Superclass YYY of class XXX not found. Did you remember to import the YYY class?
TrustProxy TrustProxy Applets behind a firewall may not have access to DNS. You must encode your CODEBASE as an IP instead of a DNS name.
type can't be private The type MyClass can't be private. Package members are always accessible within the current package. Top level classes can't be private, only classes nested inside others.
type expected Type expected. identifier expected.
  • extra }, or literally a missing type, especially in constant declarations like: public static final SOMETHING=3; instead of public static final int SOMETHING=3;
  • Executable code has to be inside some method, in a static initialiser block or in an instance initialiser block. It can't be just dangling inside a class or outside any class. Check that your {} are balanced. Code you think is in a method may actually be outside because of an extra unbalanced }.
unable to load for debugging Unable to load MyClass.class for debugging. Symantec support suggests copying all the DLLs in VCP\JAVA\BIN to VCP\BIN to correct stability problems. If you do this, all debugging will cease to function. Delete any DLL in VCP\BIN that also exists is VCP\JAVA\BIN.

Check that you fully qualified the name of your class with its package name, e.g. com.mindprod.business.TestDate in the Project section of Visual Cafe, no trailing ".class" and that the upper and lower case is precisely correct. Read the section in the glossary on CLASSPATH and under java.exe on how packages, classnames, the directory structure and the CLASSPATH all interact. If that does not solve it, I have bad news.

Windows 95 has the most incredibly inept scheme for dealing with DLLs from different vendors that just happen to have the same 8+3 name, (even when they are stored in totally different directories). Whichever application starts first gets its DLLs installed, and every other app that comes aftward has to use them. If you start some app before VC, it may load incompatible DLLs. To avoid this, load VC first. Then the other apps may stop working. Phttt! Mr. Gates has guaranteed himself a seat in hell for this (and for the confounded registry where all configuration information for all applications is lumped in one unrestorable basket). There should be separate system DLLs and application DLLs with no possibility of DLLs provided by one vendor being foisted on some other. Try starting Visual Cafe before any other app and keep it running. It stands a better chance then of getting its own DLLs loaded.

Unable to open file xxx.exe Fatal error (0): Unable to open file xxx.exe In Jet when compiling, you forgot to terminate execution of your app before redoing the compile.
unable to run Unable to run MyClass.class: Check that you have properly specified name of the class containing main in your project settings. Your vep project file is not in the same directory with the *.java and *.class files that compose the class containing Main.
undefined variable Undefined variable x; or Variable x in SomeOtherClass not accessible from MyClass Incompatible type for =.
  • caps on a variable reference
  • missing variable declaration
unexpected symbols Unexpected symbols ignored. You just coded a snippet. All code has to live inside a method and all methods have to live inside a class. The only exception are static and instance initialisers, which must be contained in {} inside a class.
UnmarshalException java.rmi.UnmarshalException: invalid method hash. Some possibilities:
  • the receiver does not have the needed class file.
  • the receiver and sender have different versions of the class file.
  • your stubs are out of date.
  • you screwed up something doing RMI. Try a very simple case and get that going, then gradually add complexity. When it stops working you have a much better idea where to look for the problem.
unreported exception Unreported exception java.text.ParseException; must be caught or declared to be thrown. The code potentially throws an exception. You must either wrap it in a
try {...}
catch (ParseException e) {...}

or put a throws declaration on the method to let the caller deal with it.
UnsatisfiedLinkError UnsatisfiedLinkError
  • You must do a System.loadLibrary( mylib ) or System.load("C:\\libs\\mylib.dll") before you can use any native methods of a class.
  • If you get the error after the class containing the native method is safely loaded, when you invoke a native method, make sure you generated your *.h file with the fully qualified class name:

    javah.exe -jni -o mouse.h com.mindprod.mouse.Mouse
    

    not simply:

    javah Mouse
  • If you get the error after the class containing the native method is safely loaded, when you invoke a native method, check that the *.cpp method signatures exactly match those in the *.h file. You should see method names like this: Java_com_mindprod_mouse_Mouse_GetMousePosition that start with the word Java and contain the package, class and method name all strung together. Make sure you remembered to implement all the methods.
  • If you get the error on your System.loadLibrary( mylib ) or System.load("C:\\libs\\mylib.dll") you may be missing the missing native class/dll.
  • If you are getting it on a System.loadLibrary( mylib ) try using System.load("C:\\libs\\mylib.dll") instead of the System.loadLibary("mylib").
  • Class name not properly qualified.
  • You need to regenerate the *.h and recompile the *.c file if you change the package name.
  • In order to execute JNI methods from a Netscape Applet, the class containing the native methods must be in the client's system class path for Netscape (C:\program files\Netscape\Communicator\program\java\classes). The DLL must be in the client's DLL classpath for Netscape (C:\program files\Netscape\Communicator\program\java\bin). If this is not done, you will be able to load the library, but not execute methods on it. I suspect there is something broken in Netscape and System.loadLibrary. I have fooled around with it for months and still cannot get it to behave reliably. See notes under JNI and capabilities.
unsorted switch Unsorted lookup switch Java won't let you have two different symbolic constants as case labels if they have the same numeric value, even if they label the same block of code.
UnsupportedDataTypeException javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain. You have an obsolete JavaMail or Java Activation Framework jar.
VerifyError Exception in thread xxx java.lang.VerifyError: Accessing value from uninitialized register 2. This is a Sun compiler bug. It comes from redefining a local variable. Just use two different names.
void type 'void' type not allowed here You are using a method that does not return a value in a place where a value is required such as the right side of an equal sign or a parameter to another method.
weaker access Attempting to assign weaker access privileges; was public. The original method you are overriding was public. Your overriding method must be public too. This often happens when you implement a method in an interface. All methods in an interface are implicitly public abstract. However, when you implement them, you must explicitly specify the public.
wrong name This is a NoClassDefFoundError where you got package name wrong at the top of the source file. It does not match the one when you built the jar. It is case sensitive.
wrong version class file has wrong version 48.0, should be 47.0 You have partly a JDK 1.4 and partly an earlier version of Java installed. Check out each copy of java.exe and with the -version option. If necessary uninstall all JDKs and JREs, prune the registry of references to Java, prune the hard disk of java directories and reinstall from scratch. Watch out for any JDKs that came embedded with an IDE. Watch out specially for the C:\WINNT\system32\java.exe. It too should be 1.4. You may have the rt.jar file from an different version.
ZipException java.util.zip.ZipException: The system cannot find the file specified. Usually the zip file in question is the distribution jar containing your class files and resources. For some reason it can't be found. You may have misspelled it or used the wrong syntax to specify it.
{ expected Syntax: { expected after this token
  • Look for a missing { slightly before where it is complaining.
  • Usually it means you put a semicolon where one was not supposed to be ahead of a {, such as at the end of an implements or extends clause. There are many errors of this type the compiler cannot catch because Java slavishly copied C syntax. For example, getting your semicolons wrong in a for loop will generally not generate an error, just give surprising results.
} expected } expected. Type expected. Identifier expected.
  • Missing } at the end of a class.
  • Missing } is on a line containing // before the }.
  • Failure to enclose initialiser code in {} or static {}.
  • Code has to live inside some method, or inside some initialiser. It can't just be left lying out in the middle of the class declarations.
  • forgetting static { } around class init code.
  • Perhaps you wrote

    interface X implements Y
       {
      ...
       }
    

    instead of

    interface X extends Y
       {
      ...
       }
    

Bugs

There are also outright bugs in the various Java compilers and runtimes. Sun maintains a searchable list at http://developer.java.sun.com. Don't be put off by the login id and password. It is free to register. You can also submit bugs, and vote on which bugs you feel should be given highest priority. They also accept feature requests and gotchas as bugs.

You can also use http://java.sun.com/cgi-bin/bugreport.cgi.

Use search engines, DejaNews, the newsgroups such as comp.lang.java.programmer, and the Java Developer Connection web pages to see if others have reported a similar bug.

Similarly you can contact Netscape via http://developer.netscape.com.

You can report bugs in Microsoft's SDK via http://www.microsoft.com/java/misc/sdkbug.htm.

If you think you have found a new bug, build a small test case that clearly demonstrates the bug. Most reported bugs are not bugs at all, but coding errors. If you can keep your example small enough, you will be much more convincing that you truly have found a bug. Ask a friend to test the code on another platform to help decide if the problem is with the compiler or the JVM or a native library.

Finally, if you would just like to complain about the design of Java or its implementation, you can expound on the comp.lang.java.advocacy newsgroup or send email to feedback@java.sun.com.


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 79241.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/errormessages.html J:\mindprod\jgloss\errormessages.html