Error |
Solution |
"Bad command or filename" |
Did you spell everything right? If so,
you [probably have not set your PATH environment variable correctly and
the computer cannot find the javac or java virtual machine executable.
Either set your path correctly, or reference the executable exactly with
something like:
C:\Java\Sun\jdk1.1.4\Bin\javac Test.java |
"ClassDefNotFound Error" |
You have not defined your CLASSPATH correctly
and the java compiler cannot find the java class library it needs in order |
"Public class Test must be defined in a file called 'Test.java'" |
You have to be careful about case-sensitivity
when programming in Java. You probably typed "javac test.java." Try typing
the javac command again with a capital "T" |
"Can't find class Test/class" |
You were probably trying to execute your
compiled test class and typed java Test.class. You should not use the .class
extension. Try typing
java Test
|
"Can't find class test" |
Case sensitivity again! You probably typed
"java test" and it should be "java Test" |
"Test.java:7: ';' expected". |
You forgot to end that line with a semi-colon |
"Return required at end of java.lang.String getAnnouncement()" |
You forgot to say
return _announcement;
at the end of this method. Remember that if you say you are going to return
something, you have to do it. |
"Announcer.java:22: Undefined variable: _announcement" |
In this case, _announcement is spelled
wrong. However, it could also mean that you have defined the _announcement
variable in a method that is not accessible. Remember that if you want
variables to be available to other methods in the same class, you must
declare them outside of the method. |