BlueJ provides help with many compilation errors. Use the on-screen Help button.
The list below is to supplement BlueJ. These are arranged in alphabetic order.
- *** expected - compilation error
For example:
" ';' expected"
BlueJ is expecting something different - here a ';'. The line where the error was detected is highlighted.
The usual situation where this would occur is missing a ';' at the end of a line of code. However, since a ';' is not required at the end of every program line don't simply add one. Think about it first.
- Cannot return a value from a method whose result type is
void - compilation error
-
Getter methods return a result and its signature (heading line) includes the result's type.
Setter methods don't return a result and include void in their signature. They mustn't include a return instruction.
- Can't resolve symbol - compilation or runtime error
For example:
"Error: Can't resolve symbol.
Symbol : variable fred."
BlueJ can't recognise a word you've used, here "fred".
This may be because BlueJ is expecting a String and you forgot to include the necessary surrounding quotes, "fred".
This error may be because an identifier is mis-spelt: you typed 'modle' instead of 'model'.
|
|
Can't resolve symbol #1
|
A common situation is forgetting to use capital 'S' for the class name System
|
|
Can't resolve symbol #2
|
This error might also occur if you used a method name but forgot to follow it by its parentheses '( )'.
- Error Saving File
This may mean you're trying to save a file to some folder where you're not allowed to save. If you're using a provided project maybe you didn't change the directory in order to save in your area
- Incompatible types - compilation or runtime error
For example:
"Error: Incompatible types.
found : boolean.
required: java.lang.String"
BlueJ has found a boolean (true or false) value where it was expecting a String
- IllegalAccessError - runtime error
For example:
"IllegalAccessError:
tried to access class xxx from class _SHELLnn (in _SHELLnn)"
BlueJ has tried use a 'standard' class of the same name as the one you are creating. This may be because you actually are using a class name which has already been used for a standard (imported library) class or because your BlueJ setup is looking in an inappropriate place for standard libraries.
- Instance name must be a Java identifier - runtime error
When an instance (an object) is created the name you give it must follow the rules for a Java identifier.
The most likely way in which this may happen is by trying to give an instance a name which includes a 'space'. Use capital letters to make second and subsequent words stand out eg firstBike.
|
|
Invalid Java identifier
|
- Invalid Class Name
A class name can't contain spaces or punctuation characters (other than underscore '_'). It is conventional for class names to start with a capital letter.
- NoClassDefFoundError - a runtime error
For example:
NoClassDefFoundError:
aLibrary/AWindow$1 (in aLibrary.AWindow)
A .class file required by the program can't be found. Here it is file AWindow$1.class.
In this example the problem probably arises from an error with the 'aLibrary' library CD distributed with Riley's textbook. To correct this, rename file:
AWindow_1.class as
AWindow$1.class and
AWindow_2.class as
AWindow$2.class
- Package *** does not exist
The package is not known to BlueJ. You need to configure BlueJ so that BlueJ can find it. If this is a package you've written or is locally provided (such as aLibrary or MisIO) then follow the configuration instructions. (You dont need to do this to access aLibrary or MisIO at the University.)