Key Founders
Java was the brainchildof:
James Gosling
Patrick Naughton
Mike Sheridan
The origin of Javacan be traced back to the fall of 1991, and was
initially called Greentalk later renamed to Oak.
Oak was renamed as Java in 1995
Sensitivity: Intemal & Restricted O 2017 Wpro woro oomm sonoert
Design Goal
Java was originally meant to be a platform-neutral language for
embedded software in devices.
The goal was to move away from platform and
and OS-specific compilers
that would compile source for a particular target platform to a language
that would be portable, and platform-independent.
The languagecould be used to produce platform-neutralcode.
Sensitivity. Intermal & Restricted 2017 Wore Bonfidanta
Java Architecture
Run-time Environment
Compile-time
step3
Environment
step1 Class Java
Class
Java
Source Loader Libraries
(Java)
Bytecode
Verifier step4
Java
step2
Bytecodes
move locally Just in
Java Compiler Java
Time step5
or through Interpreter
Compiler Java
network
Virtual
machine
Runtime System
Java
Bytecode
(.class ) Operating System
Hardware
Sensitivity: Intenal & Restricted e2017 Wpra ipro. com confidental
Java Architecture (Contd.).
Step1:
Create ajava source code with java extension
Step2:
Compile the source code using java compiler, which will create bytecode file with .class
extension
Step3:
Class loader reads both the user defined and library classes into the memory forexecution
Sensitivity: Internal & Restricted 2017 pns
Java Architecture (Contd.).
Step4:
Bytecode verifier validates all the bytecodes are valid and do not violate Java's security
restrictions
Step5:
JVM reads bytecodes and translates into machine code for execution. While execution of the
program the code will interact to the operating system and hardware
Sensitivity, Intemal & Restricted
The 5 phases of Java Programs
Java programs can typically be developedin five stages:
1. Edit
Use an editor to typeJava program (Welcome.java)
2. Compile
• Use a compiler to translate Java program into an intermediate language called
bytecodes, understood by Java interpreter (javacWelcome.java)
• Use a compiler to create .class file, containing bytecodes(Welcome.class)
3. Loading
Use a class loader to read bytecodes from .class file into memory
Sensitivity: Internal & Restrcted e2017 Wipro onfa
The 5 phases of Java Programs (Contd.).
4. Verify
Use a Bytecode verifier to make sure bytecodes are valid and do not violate security
restrictions
5. Execute
Java Virtual Machine (JVM) uses a combination of interpretation and just-in-time
compilation to translate bytecodes into machine language
• Applications are run on user's machine, i.e. executed by interpreter with java command
(java Welcome)
Sensitrvity Internal & Resticted 2017 ero
Java Virtual Machine
Java Program
class HelloWorldApp
public static void main (Stringl]args)
• The output of the compiler is bytecode
System.out.println ("HO115 World)
The bytecodes are executed by JVM
HelloOrldApp.java • It is an interpreter which converts the
byte code to machine specific
Compiler
instructions
JVM JVM and executes
JVM
• JVM is platform specific
Win32 UNIX MacOS
Sensitivity interna & Restricted 2017 Wipro wipra ao canidenta
The Java Architecture -TheJVM (Contd.).
Most modern languagesaredesigned to be compiled
Compilation is a one-time exercise and executes faster
Execution of compiled code over the Internet an impossibility
Executable code always generated to a CPU-OS combination
Interpreting a Java program into byte code facilitates its execution in a wide variety of
environments
The Java Architecture - The JVM (Contd.).
Only the Java Virtual Machine (JVM)needs to be implemented for each platform
Once the Java runtimepackage exists for a given system,any Java program can run on it
The JVM will differ from platform to platform, and is,platform-spe
All versions ofJVM interprets the Java byte codes.
Sensitrvity: Internal & Restricted 9 2017 Nipro wipro com oonfidenoa
The Java Architecture - The JVM (Contd.).
Interpreted code runs much slower compared to executable code
The use of bytecode enables the Java runtime system to execute programs much faster
Java facilitates on-the-fly compilation of bytecode into native code
15
Sensitivity. Internal & Restricted 2017 Wipro WIproCom confdenia
The Java Architecture -The Adaptive optimizer
Another type of execution engine is an adaptive optimizer
- The virtual machine starts by interpreting bytecodes
It also keeps a tab on the code that is running and identifies only the heavily used areas
The JVM compilesthese heavily used areas of code into native code
The rest of the code, which is not heavily used continues to be interpreted and executed
Sensitivity Internal & Restricted 2017 Wet
The Java Architecture -The Class Loader
The class loaderis that part of the VM that is importantfrom:
A security standpoint
Network mobility
The class loader loads a compiled Java source file (.class files represented as bytecode) into
the Java Virtual Machine (JVM)
The bootstrap class loader is responsible for loading the classes, programmer defined clas:
as well as Java's API classes
Sensitrity Intenal & Restrcted
The Java Architecture - The Java .classfile
The Java class file is designed for
platform independence
network mobility
The class file is compiled to a target JVM, but independent of underlying hostplatforms
The Java class file is a binary file that has the capability to run on any platform
Sensitivity Internal& Restricted 2017 WNbr i onoetia