What needs to happen before computer can run a program:

  1. Enter/edit the program into a file.

    The classic first Java program:

    A Java program file name must end in ".java"

    The classic first C program:

    A C program file name must end in ".c"

    The program file is now in human readable form and it is not executable by the computer.

  2. Translate the human readable program text into an computer executable program.

    This step has been automated and the tool used to translate human readable programs into computer executable programs is called a "compiler". (This step is called "compilation").

    The object file contains a sequence of "computer instructions" or "machine instructions" that the computer can execute.

  3. For larger programs, you may need to "link" in different functions that you have developed previously or provided by the computer system (libraries).

    In most common cases, the linking is transparant to the computer user.

  4. Note: There is no computer that can execute the Java machine language. Java is a "virtual" machine - the Java machine is defined on paper and does not exist in real life.

    Programs have been written that "mimic" the Java machine. Programs that mimic a machine are called "emulators". A program that emulates the Java machine is called a "Java Virtual Machine" or "JVM".

    The program java is a JVM and is used to run Java object files in UNIX. So to run a Java object file, type:

    
    	java your_program_filename