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.
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:
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.
| 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. |
|
|
| ; 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.
|
|
| 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. |
|
|
| 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 |
|
|
| 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 not found | Class not found | This can occur at compile or run time.
|
|
| 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. |
|
|
| 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 |
|
|
| 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. |
|
|
| 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 |
|
|
| IllegalAccessError | IllegalAccessError |
|
|
| 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 |
|
|
| 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. |
|
|
| IOException | IOException: invalid header field |
|
|
| 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 |
|
|
| misplaced construct | misplaced construct |
|
|
| 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. |
|
|
| impotent setters | no warning. impotent setters. |
|
|
| 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. |
|
|
| 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
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.
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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.
|
|
| 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. |
|
|
| 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. |
|
|
| 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 =. |
|
|
| 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:
|
|
| 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 |
|
|
| 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 |
|
|
| } expected | } expected. Type expected. Identifier expected. |
|
|
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.
home |
Canadian Mind Products | |||
| 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 | |||