go to previous page   go to home page   hear noise   go to next page


You would compile the old, uncorrected version of the source file on hard disk and get the same error message.

When you use a text editor you change the source program that is in main memory. If you don't save your changes, the file on disk does not change. The compiler javac uses the file that is currently on the hard disk.

This is a common mistake.

Edit, Compile, Run Cycle

Until your program runs correctly:

  1. Edit the program (the source file).
  2. Save the program to the hard disk with the "Save" or "Save As" command of the editor.
  3. Compile the program with the javac command.
  4. If there are syntax errors, go back to step 1.
  5. Run the program with the java command.
  6. If there are bugs, go back to step 1.
  7. When it runs correctly, quit.

This is called the "edit-compile-and-run" cycle. Expect to go through it many times per program. A Java development environment like Eclipse or BlueJ is more sophisticated, but you still go through the same fundamental cycle.


If a source program compiles correctly in step 3, does that mean that it will run correctly?