Other Reasons It Might Not Work
Here are some other things that might go wrong even if the PATH is set correctly:
Make sure you are in the right directory; type ls and check that the file
CreeperTest.java is right there.
Make sure you're typing javacCreeperTest.java (with the .java part). Otherwise you
might see a truly confusing error message like this one:
error: Class names, 'CreeperTest', are only accepted if
annotation processing is explicitly requested
If the javac command reports some kind of “syntax” or “not found” or “not
defined” error, that means it doesn't understand the text in the CreeperTest.java
file, so you may have mistyped something. These kinds of errors might look
something like this:
CreeperTest.java:1: class, interface, or enum expected
Or you might see some other error message. The number in between the
colons ( :1: ) is the line number where the typo is located.
If you can't find the typo, grab a fresh copy of the file from this topic's down-
loaded source code, at code/install/CreeperTest.java , and try that.
If the java command can't find CreeperTest.class , make sure the javac command
ran okay and that it produced a .class file successfully. You should be in that
same directory when running java .
If you see this error
Exception in thread "main" java.lang.NoClassDefFoundError: CreeperTest/class
you may have accidentally typed javaCreeperTest.class (with the .class part at the
end) instead of java CreeperTest (no suffix). To recap, these are the commands
to compile and then run:
$ javac CreeperTest.java
$ java CreeperTest
That is, you must specify the .java suffix when compiling, but do not type in
the .class part when running with java .
Also, check to see if there's a setting for CLASSPATH (which is just like PATH , but
for Java classes).
$ echo $CLASSPATH