0% found this document useful (0 votes)
2 views33 pages

Java Architecture

The document provides an overview of Java, a high-level, object-oriented programming language known for its platform independence and robustness. It details Java's architecture, the evolution of the language, the differences between Java Development Kit (JDK) and Java Runtime Environment (JRE), and compares Java with C and C++. Key features such as the Java Virtual Machine (JVM) and the five phases of Java program development are also discussed.

Uploaded by

dhruvv060606
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views33 pages

Java Architecture

The document provides an overview of Java, a high-level, object-oriented programming language known for its platform independence and robustness. It details Java's architecture, the evolution of the language, the differences between Java Development Kit (JDK) and Java Runtime Environment (JRE), and compares Java with C and C++. Key features such as the Java Virtual Machine (JVM) and the five phases of Java program development are also discussed.

Uploaded by

dhruvv060606
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Programming in Java

Course Code: CSE2006

Designed By : Dr Sandeep Monga confidential 1


What is JAVA ?
Java is a high-level, object-oriented, platform-
independent programming language developed by
Sun Microsystems in 1995, now owned by Oracle
Corporation. It is widely used for building robust,
secure, and portable applications.

Designed By : Dr Sandeep confidential 2


Monga
Why JAVA is Popular ?
Java has remained one of the most widely used
programming languages since its inception in
1995. Its popularity stems from a combination of
technical features, practical advantages, and its
ability to adapt to evolving technology trends. One
of the most feature of JAVA is
Platform Independence
Designed By : Dr Sandeep confidential 3
Monga
What is Platform
Independent ?
Platform independence refers to the ability of
a software application or programming
language to run on multiple hardware
platforms or operating systems without
requiring modifications to the underlying code.
It ensures that the same program behaves
consistently, regardless of the system it is
executed on.
In the context of Java, platform independence
means that Java programs can run on any
device or operating system that has a Java
Virtual Machine (JVM) installed.
Designed By : Dr Sandeep confidential 4
Monga
What is Object Oriented
Programming System ?
Object-Oriented Programming System (OOPS)
is a programming paradigm that organizes data
and behavior into reusable structures called
objects. It emphasizes modeling real-world
entities and their interactions to simplify
software development, maintainability, and
scalability.

Designed By : Dr Sandeep confidential 5


Monga
Java is Pure Object
Oriented Language ?
Java is not a purely object-oriented language,
although it is often considered strongly object-
oriented. While Java emphasizes object-
oriented principles, it includes some features
that deviate from the definition of a "pure"
object-oriented language.

Designed By : Dr Sandeep confidential 6


Monga
Java Architecture

Designed By : Dr Sandeep confidential 7


Monga
Topic

Evolution of Java

Java Architecture

Designed By : Dr Sandeep confidential 8


Monga
Evolution of Java

Designed By : Dr Sandeep confidential 9


Monga
Key Founders
 Java was the brainchild of:
• James Gosling

• Patrick Naughton

• Mike Sheridan

 The origin of Java can be traced back to the fall of 1991, and was
initially called Greentalk later renamed to Oak.
 Oak was renamed as Java in 1995

Designed By : Dr Sandeep confidential 10


Monga
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 OS-specific compilers
that would compile source for a particular target platform to a language
that would be portable, and platform-independent.

 The language could be used to produce platform-neutral code.

Designed By : Dr Sandeep confidential 11


Monga
Java Architecture

Designed By : Dr Sandeep confidential 12


Monga
Java Architecture
Compile-time Run-time Environment
step3
Environment step1
Class Java
Class
Java
Source Loader Libraries
(.java)
Bytecode
Verifier step4

step2 Java
Bytecodes
Java Compiler move locally Java
Just in
Time
step5
or through Interpreter
Compiler Java
network
Virtual
machine

Runtime System

Java
Bytecode
(.class ) Operating System

Hardware

Designed By : Dr Sandeep confidential 13


Monga
Java Architecture (Contd.).
Step1:
Create a java 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 for execution

Designed By : Dr Sandeep confidential 14


Monga
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

Designed By : Dr Sandeep confidential 15


Monga
The 5 phases of Java Programs
Java programs can typically be developed in five stages:
1. Edit
Use an editor to type Java program ([Link])
2. Compile
• Use a compiler to translate Java program into an intermediate language called
bytecodes, understood by Java interpreter (javac [Link])

• Use a compiler to create .class file, containing bytecodes ([Link])


3. Loading
Use a class loader to read bytecodes from .class file into memory

Designed By : Dr Sandeep confidential 16


Monga
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)

Designed By : Dr Sandeep confidential 17


Monga
Java Virtual Machine

• The output of the compiler is bytecode


• The bytecodes are executed by JVM
• It is an interpreter which converts the
byte code to machine specific
instructions
and executes
• JVM is platform specific

Designed By : Dr Sandeep confidential 18


Monga
The Java Architecture – The JVM (Contd.).
 Only the Java Virtual Machine (JVM) needs to be implemented for each platform

 Once the Java runtime package exists for a given system, any Java program can run on it

 The JVM will differ from platform to platform, and is, platform-specific

 All versions of JVM interprets the Java byte codes.

Designed By : Dr Sandeep confidential 19


Monga
Difference between JDK and JRE

JDK (Java Development Kit) and JRE (Java Runtime Environment) are both key
components of Java development and runtime environments, but they serve different
purposes. Here's a breakdown of their differences:

Definition
• JDK (Java Development Kit): A software development kit that provides the
tools and libraries needed to develop and compile Java programs.
• JRE (Java Runtime Environment): A runtime environment for executing Java
applications. It includes the necessary libraries and JVM but lacks development
tools.

Designed By : Dr Sandeep confidential 20


Monga
Difference between JDK and JRE

Purpose
• JDK: Used by developers to create, compile, debug, and package Java applications.
• JRE: Used by end-users to run Java applications.

Components
• JDK: Includes JRE, a compiler (javac), tools like javadoc, jdb (debugger), and
utilities for developing Java applications.
• JRE: Contains the Java Virtual Machine (JVM), core libraries, and other runtime
components required to run Java applications.

Designed By : Dr Sandeep confidential 21


Monga
Difference between JDK and JRE

Usage
• JDK: Required for Java application development.
• JRE: Required for running Java applications.

Target Users
• JDK: Developers who write and compile Java code.
• JRE: Users who only need to run precompiled Java applications.

Designed By : Dr Sandeep confidential 22


Monga
Difference between JDK and JRE
(Summary Table)
Feature JDK JRE

Purpose Develop and run Java apps Run Java apps only

Components Includes JRE + dev tools Includes JVM + libraries

Target Users Developers End-users

Tools Compiler, debugger, etc. None

Size Larger Smaller

Designed By : Dr Sandeep confidential 23


Monga
Difference between C,C++ and JAVA

Aspect C C++ Java


Multi-paradigm: supports Fully object-oriented
procedural and object- programming language
Type Procedural programming language
oriented programming (with some procedural
(OOP) features)

Designed By : Dr Sandeep confidential 24


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Platform-independent
Platform Platform-dependent Platform-dependent
(via JVM)
Compiled to machine
Compiled to bytecode,
Execution code directly, runs on Same as C
runs on JVM
specific OS

Designed By : Dr Sandeep confidential 25


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Adds complexity with High-level, easy-to-read
Simplicity Simpler syntax
OOP features syntax
Uses header files No header files, uses
Header Files Uses header files
(#include) classes and packages

Designed By : Dr Sandeep confidential 26


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Memory
allocated/deallocated Manual using new and Automatic garbage
Manual Management
manually using malloc() delete collection
and free()

Designed By : Dr Sandeep confidential 27


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Fully supports OOP
OOP Support Does not support OOP Fully supports OOP
(mandatory)
Functions, no classes or Classes, objects, Classes, objects,
Key Features
objects inheritance, etc. inheritance, etc.

Designed By : Dr Sandeep confidential 28


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


System programming (OS, System + application Application programming
Use Case
drivers) programming (web, mobile)
Linux kernel, embedded Games, GUI applications, Android apps, enterprise
Examples
systems system tools applications

Designed By : Dr Sandeep confidential 29


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Fast, as it's close to Slower than both due to
Speed Slightly slower than C
hardware JVM overhead
Bytecode interpretation
Compilation Direct compilation Direct compilation and Just-In-Time (JIT)
compilation

Designed By : Dr Sandeep confidential 30


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Uses exceptions and try- Mandatory try-catch for
Error Handling Uses return and errno
catch blocks exceptions

Designed By : Dr Sandeep confidential 31


Monga
Difference between JDK and JRE
(Summary Table)

Aspect C C++ Java


Standard C Library Standard Template Library Rich libraries and
Libraries
(minimal) (STL) frameworks (JDK)

Designed By : Dr Sandeep confidential 32


Monga
Thank You

Designed By : Dr Sandeep confidential 33


Monga

You might also like