

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This handout explains the five phases of java program development: edit, compile, load, verify, and execute. The editor is used to create and save java files, the compiler translates java code into bytecodes, the class loader loads bytecodes into memory, the bytecode verifier checks the validity of bytecodes, and the interpreter executes bytecodes. Java's strong security measures are enforced during the verify phase.
Typology: Lecture notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Web Design & Development CS-
Java program normally go through five phases. These are
We look over all the above mentioned phases in a bit detail. First consider the following figure that summarizes the all phases of a java program.
Program is created in the editor and stored on disk. Compiler creates bytecodes and stores them on disk.
Class loader puts bytecodes in memory.
Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions.
Interpreter reads bytecodes and translates them into a language that the computer can understand, possibly storing data values as the program executes.
Phase 1
Phase 3
Phase 4
Phase 5
Editor
Compiler
Class Loader
Disk
Primary Memory
Primary Memory
Primary Memory
Bytecode Verifier
Interpreter
Disk
Disk
Web Design & Development CS-
Phase 1 consists of editing a file. This is accomplished with an editor program. The programmer types a java program using the editor like notepad, and make corrections if necessary.
When the programmer specifies that the file in the editor should be saved, the program is stored on a secondary storage device such as a disk. Java program file name ends with a .java extension.
On Windows platform, notepad is a simple and commonly used editor for the beginners. However java integrated development environments (IDEs) such as NetBeans, Borland JBuilder, JCreator and IBM’s Ecllipse hava built-in editors that are smoothly integrated into the programming environment.
In Phase 2, the programmer gives the command javac to compile the program. The java compiler translates the java program into bytecodes, which is the language understood by the java interpreter.
To compile a program called Welcome.java, type
javac Welcome.java
at the command window of your system. If the program compiles correctly, a file called Welcome.class is produced. This is the file containing the bytecodes that will be interpredted during the execution phase.
In phase 3, the program must first be placed in memory before it can be executed. This is done by the class loader , which takes the .class file (or files) containing the bytecodes and transfers it to memory. The .class file can be loaded from a disk on your system or over a network (such as your local university or company network or even the internet).
Applications (Programs) are loaded into memory and executed using the java interpreter via the command java. When executing a Java application called Welcome, the command
Java Welcome
Invokes the interpreter for the Welcome application and causes the class loader to load information used in the Welcome program.