SlideShare a Scribd company logo
Java Virtual Machine

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 1
Java Virtual Machine - start
Java Source Program
Java Source Program

Program
Program
Running
Running

Java ‘Compiler’
Java ‘Compiler’

Program
Program
Running
Running

JVM on LINUX PC
JVM on LINUX PC

Byte
Byte
Code
Code

JVM on Windows PC
JVM on Windows PC
JVM on iMAC
JVM on iMAC
JVM on UNIX
JVM on UNIX

© Katrin Becker
All rights reserved.

Program
Program
Running
Running

Java Virtual Machine

Program
Program
Running
Running
Jan 18, 2014 2
Java Virtual Machine - source
Java Source Program
Java Source Program

© Katrin Becker
All rights reserved.

-Written in standard Java
-Target machine irrelevant
-Doesn’t matter which machine
it’s created on.

Java Virtual Machine

Jan 18, 2014 3
Java Virtual Machine - compile
Java Source Program
Java Source Program
>> javac MyProg.java

Java ‘Compiler’
Java ‘Compiler’
Java ‘compiler’ does syntactic analysis
and parsing.
Translates source into Byte Code
MyProg.class

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 4
Java Virtual Machine - Byte Code
Java Source Program
Java Source Program
Bytecode is
the same for ALL machines
Java ‘Compiler’
Java ‘Compiler’
and ALL versions of Java
Up to this point everything looks
and behaves identically
on ALL machines
Bytecode is assembler-like, but there
Byte
Byte
is no really real machine that
‘understands’ bytecode.
Code
Code
Called Bytecode because most
instructions are one or two
bytes long
© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 5
Java Virtual Machine – ready-set-..
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

•Bytecode can be transported to
any machine with a bytecode
interpreter [called the “Java
Virtual Machine”]
•Assemblers run on real
machines, so…..
•Java Bytecode runs on a
“Virtual Machine”

Java Virtual Machine

Jan 18, 2014 6
Java Virtual Machine – go
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

•The Virtual Machine is like a
simulator – it simulates a real
machine, but…
•It also ‘tells’ the real machine
on which it is currently running
to do the stuff the virtual
machine would be doing
•This requires it to be ‘tailormade’ for the machine it is
running on…

Java Virtual Machine

Jan 18, 2014 7
Java Virtual Machine - Linux
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’
JVM on LINUX PC
JVM on LINUX PC

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 8
Java Virtual Machine – Linux-b
Java Source Program
Java Source Program

Program
Program
Running
Running

Java ‘Compiler’
Java ‘Compiler’
JVM on LINUX PC
JVM on LINUX PC

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 9
Java Virtual Machine - Windows
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

JVM on Windows PC
JVM on Windows PC

Java Virtual Machine

Jan 18, 2014 10
Java Virtual Machine – Windows-b
Java Source Program
Java Source Program
Program
Program
Running
Running

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

JVM on Windows PC
JVM on Windows PC

Java Virtual Machine

Jan 18, 2014 11
Java Virtual Machine - iMAC
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

JVM on iMAC
JVM on iMAC

Java Virtual Machine

Jan 18, 2014 12
Java Virtual Machine – iMAC-b
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code

© Katrin Becker
All rights reserved.

Program
Program
Running
Running
JVM on iMAC
JVM on iMAC

Java Virtual Machine

Jan 18, 2014 13
Java Virtual Machine - UNIX
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code
JVM on UNIX
JVM on UNIX
© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 14
Java Virtual Machine – UNIX-b
Java Source Program
Java Source Program

Java ‘Compiler’
Java ‘Compiler’

Byte
Byte
Code
Code
JVM on UNIX
JVM on UNIX
© Katrin Becker
All rights reserved.

Java Virtual Machine

Program
Program
Running
Running
Jan 18, 2014 15
Java Virtual Machine ..TA-Da
Java Source Program
Java Source Program

Program
Program
Running
Running

Java ‘Compiler’
Java ‘Compiler’

Program
Program
Running
Running

JVM on LINUX PC
JVM on LINUX PC

Byte
Byte
Code
Code

JVM on Windows PC
JVM on Windows PC
JVM on iMAC
JVM on iMAC
JVM on UNIX
JVM on UNIX

© Katrin Becker
All rights reserved.

Program
Program
Running
Running

Java Virtual Machine

Program
Program
Running
Running
Jan 18, 2014 16
Once more from the top
A slightly different
perspective….

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 17
Java Source :: JVM -1
JVM source written in C
JVM source written in C

Somebody writes the “Java Virtual Machine”;
Jim Gosling probably wrote the first one.

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 18
Java Source :: JVM -2
JVM source written in C
JVM source written in C

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

JVM.c gets compiled to produce….

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 19
Java Source :: JVM -3
JVM source written in C
JVM source written in C

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’
JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

There has to be a specially tailored
one of these for the specific
machine we are currently using.

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 20
Java Source :: JVM –3b
JVM source written in C
JVM source written in C

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’
JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

The ‘Java Virtual Machine’ is now
ready to be used (invoked).
It can sit around on the system
indefinitely.
© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 21
Java Source :: JVM -4
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

Along comes My
Program,
written in Java

© Katrin Becker
All rights reserved.

JVM source written in C
JVM source written in C

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’
JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

Java Virtual Machine

Jan 18, 2014 22
Java Source :: JVM -5
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

>> javac MyProg.java
Results in…..

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

The Java compiler gets invoked –
It takes standard Java source as input
And produces standard Java ByteCode as output
© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 23
Java Source :: JVM -6
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

Now I am free to take my MyProg.class to
any computer I choose,
Any brand; any flavour; anywhere in the world
PROVIDED…
It has a working JVM.exe
© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 24
Java Source :: JVM –6b
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

When I say:
>> java MyProg.class

© Katrin Becker
All rights reserved.

The target machine loads, and then starts to
run the
Java Virtual Machine….
Java Virtual Machine

Jan 18, 2014 25
Java Source :: JVM -7
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

Machine-dependent
Machine-dependent
Linker/Loader
Linker/Loader

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 26
Java Source :: JVM -8
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

Machine-dependent
Machine-dependent
Linker/Loader
Linker/Loader

The JVM expects
a file containing
ByteCode as input
© Katrin Becker
All rights reserved.

‘Java’ Program
‘Java’ Program
Running bytecode
Running bytecode
as input
as input

Java Virtual Machine

Jan 18, 2014 27
Java Source :: JVM -9
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

MyProg.class
MyProg.class
Program
Program
Running
Running
© Katrin Becker
All rights reserved.

The output
JVM.exe
JVM.exe
from the JVM
(executable version of
(executable version of
is the output
JVM)
JVM)
that your
program
Machine-dependent
Machine-dependent
produces
Linker/Loader
Linker/Loader
(unless of
course the
‘Java’ Program
‘Java’ Program JVM detects a
Running bytecode
Running bytecode problem)
as input
as input
Java Virtual Machine

Jan 18, 2014 28
Java Source :: JVM -10
Java Source Program:
Java Source Program:
MyProg.java
MyProg.java

JVM source written in C
JVM source written in C

Java ‘Compiler’
Java ‘Compiler’

C compiler compiles ‘JVM.c’
C compiler compiles ‘JVM.c’

Byte
Byte
Code
Code

JVM.exe
JVM.exe
(executable version of
(executable version of
JVM)
JVM)

Machine-dependent
Machine-dependent
Linker/Loader
Linker/Loader

MyProg.class
MyProg.class
Program
Program
Running
Running
© Katrin Becker
All rights reserved.

‘Java’ Program
‘Java’ Program
Running bytecode
Running bytecode
as input
as input

Java Virtual Machine

MyProg
MyProg
output
output
Jan 18, 2014 29
The end.

© Katrin Becker
All rights reserved.

Java Virtual Machine

Jan 18, 2014 30

More Related Content

What's hot (20)

PPTX
Java JVM
KadarkaraiSelvam
 
DOCX
Java Tutorial to Learn Java Programming
business Corporate
 
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
DOCX
JDK,JRE,JVM
Cognizant
 
PDF
Java unit 1
Shipra Swati
 
PPT
1 Introduction To Java Technology
dM Technologies
 
PDF
The Real Thing: Java Virtual Machine
Frontech
 
DOCX
Introduction to java
jayc8586
 
PDF
Java and Java platforms
Ilio Catallo
 
PPTX
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
shamnasain
 
PPTX
Introduction to Java Programming
Saravanakumar R
 
PDF
Java introduction
Kuppusamy P
 
PPTX
JAVA ENVIRONMENT
josemachoco
 
PPTX
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
PDF
Learn Java Part 1
Gurpreet singh
 
ODP
Java compilation
Mike Kucera
 
PDF
Lecture 3
Debasish Pratihari
 
Java Tutorial to Learn Java Programming
business Corporate
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
JDK,JRE,JVM
Cognizant
 
Java unit 1
Shipra Swati
 
1 Introduction To Java Technology
dM Technologies
 
The Real Thing: Java Virtual Machine
Frontech
 
Introduction to java
jayc8586
 
Java and Java platforms
Ilio Catallo
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
shamnasain
 
Introduction to Java Programming
Saravanakumar R
 
Java introduction
Kuppusamy P
 
JAVA ENVIRONMENT
josemachoco
 
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
Learn Java Part 1
Gurpreet singh
 
Java compilation
Mike Kucera
 

Viewers also liked (20)

PDF
Introduction to virtualization
Sasikumar Thirumoorthy
 
PDF
Android Lesson 2
Daniela Da Cruz
 
PPT
Virtual machine
Nikunj Dhameliya
 
PPT
Virtual machine subhash gupta
Subhash Chandra Gupta
 
ODP
Android App Development - 02 Activity and intent
Diego Grancini
 
PPTX
Android development session 2 - intent and activity
Farabi Technology Middle East
 
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
vwchu
 
PPTX
Virtual machine
IGZ Software house
 
PPTX
Virtualization
Srisailam Reddy Kanapuram
 
PDF
Virtualization and cloud Computing
Rishikese MR
 
PDF
Virtualization presentation
Mangesh Gunjal
 
PPT
Virtualization in cloud computing ppt
Mehul Patel
 
PPTX
Virtualization 101: Everything You Need To Know To Get Started With VMware
Datapath Consulting
 
PDF
What Makes Great Infographics
SlideShare
 
PDF
Masters of SlideShare
Kapost
 
PDF
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
Empowered Presentations
 
PDF
You Suck At PowerPoint!
Jesse Desjardins - @jessedee
 
PDF
10 Ways to Win at SlideShare SEO & Presentation Optimization
Oneupweb
 
PDF
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
Content Marketing Institute
 
PDF
How to Make Awesome SlideShares: Tips & Tricks
SlideShare
 
Introduction to virtualization
Sasikumar Thirumoorthy
 
Android Lesson 2
Daniela Da Cruz
 
Virtual machine
Nikunj Dhameliya
 
Virtual machine subhash gupta
Subhash Chandra Gupta
 
Android App Development - 02 Activity and intent
Diego Grancini
 
Android development session 2 - intent and activity
Farabi Technology Middle East
 
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
vwchu
 
Virtual machine
IGZ Software house
 
Virtualization and cloud Computing
Rishikese MR
 
Virtualization presentation
Mangesh Gunjal
 
Virtualization in cloud computing ppt
Mehul Patel
 
Virtualization 101: Everything You Need To Know To Get Started With VMware
Datapath Consulting
 
What Makes Great Infographics
SlideShare
 
Masters of SlideShare
Kapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
Empowered Presentations
 
You Suck At PowerPoint!
Jesse Desjardins - @jessedee
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
Oneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
Content Marketing Institute
 
How to Make Awesome SlideShares: Tips & Tricks
SlideShare
 
Ad

Similar to CS Lesson: Introduction to the Java virtual Machine (20)

PDF
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu...
NETWAYS
 
PDF
Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)
jaxLondonConference
 
PPTX
Decapitating Selenium with JavaScript
Alan Parkinson
 
KEY
Vagrant
Michael Peacock
 
PDF
Building your own Desktop Cloud Environment
Jnaapti
 
PDF
Installing vmware server 2.0.2 on windows7
Ravi Kumar Lanke
 
PDF
Create Development and Production Environments with Vagrant
Brian Hogan
 
PDF
JRuby on Rails Deployment: What They Didn't Tell You
elliando dias
 
PDF
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
Anthony Dahanne
 
PPTX
Java Class1
Mayank Aggarwal
 
PDF
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
HostedbyConfluent
 
PDF
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
Anthony Alvarez
 
PPTX
Real time data processing with kafla spark integration
TCS
 
PDF
Vagrant for Development
Jacky Chan
 
PDF
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Ravi Kumar Lanke
 
PDF
JavaFX JumpStart @JavaOne 2016
Hendrik Ebbers
 
ODP
Puppet Provisioning Vagrant Virtual Machine
Arpit Aggarwal
 
PDF
SFScon 21 - Davide Montesin - Typescript vs. Java
South Tyrol Free Software Conference
 
PDF
GraalVm and Quarkus
Sascha Rodekamp
 
OSDC 2019 | Virtualisation in Docker, using KVM as Hypervisor by Kososochukwu...
NETWAYS
 
Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)
jaxLondonConference
 
Decapitating Selenium with JavaScript
Alan Parkinson
 
Building your own Desktop Cloud Environment
Jnaapti
 
Installing vmware server 2.0.2 on windows7
Ravi Kumar Lanke
 
Create Development and Production Environments with Vagrant
Brian Hogan
 
JRuby on Rails Deployment: What They Didn't Tell You
elliando dias
 
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
Anthony Dahanne
 
Java Class1
Mayank Aggarwal
 
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
HostedbyConfluent
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
Anthony Alvarez
 
Real time data processing with kafla spark integration
TCS
 
Vagrant for Development
Jacky Chan
 
Installing Endeca Server, Studio, Integrator ETL , Commerce and Platform Serv...
Ravi Kumar Lanke
 
JavaFX JumpStart @JavaOne 2016
Hendrik Ebbers
 
Puppet Provisioning Vagrant Virtual Machine
Arpit Aggarwal
 
SFScon 21 - Davide Montesin - Typescript vs. Java
South Tyrol Free Software Conference
 
GraalVm and Quarkus
Sascha Rodekamp
 
Ad

More from Katrin Becker (20)

PPTX
Cross breeding animation
Katrin Becker
 
PPT
Assignments that Meet the Needs of Exceptional Students without Disadvantagin...
Katrin Becker
 
PPTX
T.A.P. : The Teach Aloud Protocol
Katrin Becker
 
PPTX
Misguided illusions of understanding
Katrin Becker
 
PPTX
Signature pedagogy
Katrin Becker
 
PPTX
Virtue of Failure
Katrin Becker
 
PPTX
4 Pillars of DGBL: A Structured Rating System for Games for Learning
Katrin Becker
 
PPTX
Gamification paradigm
Katrin Becker
 
PPTX
The Calm and The Storm: Simulation and Games - Why All Games are Simulations ...
Katrin Becker
 
PPTX
Gamification how to gamify learning and instruction Part 1 (of 3)
Katrin Becker
 
PPTX
Gamification how to gamify learning and instruction, part 2 (of 3)
Katrin Becker
 
PPTX
Is gamification a game changer
Katrin Becker
 
PPT
CS Example: Parsing a Sentence
Katrin Becker
 
PPT
CS: Introduction to Record Manipulation & Indexing
Katrin Becker
 
PPT
CS Lesson: Creating Your First Class in Java
Katrin Becker
 
PPTX
Informing pedagogy through collaborative inquiry
Katrin Becker
 
PPTX
Informing SoTL using playtesting techniques
Katrin Becker
 
PPTX
Using cards games as learning objects to teach genetics
Katrin Becker
 
PPTX
Gamification how to gamify learning and instruction, Part 3 (of 3)
Katrin Becker
 
PPTX
The decorative media trap
Katrin Becker
 
Cross breeding animation
Katrin Becker
 
Assignments that Meet the Needs of Exceptional Students without Disadvantagin...
Katrin Becker
 
T.A.P. : The Teach Aloud Protocol
Katrin Becker
 
Misguided illusions of understanding
Katrin Becker
 
Signature pedagogy
Katrin Becker
 
Virtue of Failure
Katrin Becker
 
4 Pillars of DGBL: A Structured Rating System for Games for Learning
Katrin Becker
 
Gamification paradigm
Katrin Becker
 
The Calm and The Storm: Simulation and Games - Why All Games are Simulations ...
Katrin Becker
 
Gamification how to gamify learning and instruction Part 1 (of 3)
Katrin Becker
 
Gamification how to gamify learning and instruction, part 2 (of 3)
Katrin Becker
 
Is gamification a game changer
Katrin Becker
 
CS Example: Parsing a Sentence
Katrin Becker
 
CS: Introduction to Record Manipulation & Indexing
Katrin Becker
 
CS Lesson: Creating Your First Class in Java
Katrin Becker
 
Informing pedagogy through collaborative inquiry
Katrin Becker
 
Informing SoTL using playtesting techniques
Katrin Becker
 
Using cards games as learning objects to teach genetics
Katrin Becker
 
Gamification how to gamify learning and instruction, Part 3 (of 3)
Katrin Becker
 
The decorative media trap
Katrin Becker
 

Recently uploaded (20)

PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Digital Circuits, important subject in CS
contactparinay1
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 

CS Lesson: Introduction to the Java virtual Machine

  • 1. Java Virtual Machine © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 1
  • 2. Java Virtual Machine - start Java Source Program Java Source Program Program Program Running Running Java ‘Compiler’ Java ‘Compiler’ Program Program Running Running JVM on LINUX PC JVM on LINUX PC Byte Byte Code Code JVM on Windows PC JVM on Windows PC JVM on iMAC JVM on iMAC JVM on UNIX JVM on UNIX © Katrin Becker All rights reserved. Program Program Running Running Java Virtual Machine Program Program Running Running Jan 18, 2014 2
  • 3. Java Virtual Machine - source Java Source Program Java Source Program © Katrin Becker All rights reserved. -Written in standard Java -Target machine irrelevant -Doesn’t matter which machine it’s created on. Java Virtual Machine Jan 18, 2014 3
  • 4. Java Virtual Machine - compile Java Source Program Java Source Program >> javac MyProg.java Java ‘Compiler’ Java ‘Compiler’ Java ‘compiler’ does syntactic analysis and parsing. Translates source into Byte Code MyProg.class © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 4
  • 5. Java Virtual Machine - Byte Code Java Source Program Java Source Program Bytecode is the same for ALL machines Java ‘Compiler’ Java ‘Compiler’ and ALL versions of Java Up to this point everything looks and behaves identically on ALL machines Bytecode is assembler-like, but there Byte Byte is no really real machine that ‘understands’ bytecode. Code Code Called Bytecode because most instructions are one or two bytes long © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 5
  • 6. Java Virtual Machine – ready-set-.. Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. •Bytecode can be transported to any machine with a bytecode interpreter [called the “Java Virtual Machine”] •Assemblers run on real machines, so….. •Java Bytecode runs on a “Virtual Machine” Java Virtual Machine Jan 18, 2014 6
  • 7. Java Virtual Machine – go Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. •The Virtual Machine is like a simulator – it simulates a real machine, but… •It also ‘tells’ the real machine on which it is currently running to do the stuff the virtual machine would be doing •This requires it to be ‘tailormade’ for the machine it is running on… Java Virtual Machine Jan 18, 2014 7
  • 8. Java Virtual Machine - Linux Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ JVM on LINUX PC JVM on LINUX PC Byte Byte Code Code © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 8
  • 9. Java Virtual Machine – Linux-b Java Source Program Java Source Program Program Program Running Running Java ‘Compiler’ Java ‘Compiler’ JVM on LINUX PC JVM on LINUX PC Byte Byte Code Code © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 9
  • 10. Java Virtual Machine - Windows Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. JVM on Windows PC JVM on Windows PC Java Virtual Machine Jan 18, 2014 10
  • 11. Java Virtual Machine – Windows-b Java Source Program Java Source Program Program Program Running Running Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. JVM on Windows PC JVM on Windows PC Java Virtual Machine Jan 18, 2014 11
  • 12. Java Virtual Machine - iMAC Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. JVM on iMAC JVM on iMAC Java Virtual Machine Jan 18, 2014 12
  • 13. Java Virtual Machine – iMAC-b Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code © Katrin Becker All rights reserved. Program Program Running Running JVM on iMAC JVM on iMAC Java Virtual Machine Jan 18, 2014 13
  • 14. Java Virtual Machine - UNIX Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code JVM on UNIX JVM on UNIX © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 14
  • 15. Java Virtual Machine – UNIX-b Java Source Program Java Source Program Java ‘Compiler’ Java ‘Compiler’ Byte Byte Code Code JVM on UNIX JVM on UNIX © Katrin Becker All rights reserved. Java Virtual Machine Program Program Running Running Jan 18, 2014 15
  • 16. Java Virtual Machine ..TA-Da Java Source Program Java Source Program Program Program Running Running Java ‘Compiler’ Java ‘Compiler’ Program Program Running Running JVM on LINUX PC JVM on LINUX PC Byte Byte Code Code JVM on Windows PC JVM on Windows PC JVM on iMAC JVM on iMAC JVM on UNIX JVM on UNIX © Katrin Becker All rights reserved. Program Program Running Running Java Virtual Machine Program Program Running Running Jan 18, 2014 16
  • 17. Once more from the top A slightly different perspective…. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 17
  • 18. Java Source :: JVM -1 JVM source written in C JVM source written in C Somebody writes the “Java Virtual Machine”; Jim Gosling probably wrote the first one. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 18
  • 19. Java Source :: JVM -2 JVM source written in C JVM source written in C C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ JVM.c gets compiled to produce…. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 19
  • 20. Java Source :: JVM -3 JVM source written in C JVM source written in C C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) There has to be a specially tailored one of these for the specific machine we are currently using. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 20
  • 21. Java Source :: JVM –3b JVM source written in C JVM source written in C C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) The ‘Java Virtual Machine’ is now ready to be used (invoked). It can sit around on the system indefinitely. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 21
  • 22. Java Source :: JVM -4 Java Source Program: Java Source Program: MyProg.java MyProg.java Along comes My Program, written in Java © Katrin Becker All rights reserved. JVM source written in C JVM source written in C C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) Java Virtual Machine Jan 18, 2014 22
  • 23. Java Source :: JVM -5 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ >> javac MyProg.java Results in….. JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) The Java compiler gets invoked – It takes standard Java source as input And produces standard Java ByteCode as output © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 23
  • 24. Java Source :: JVM -6 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) Now I am free to take my MyProg.class to any computer I choose, Any brand; any flavour; anywhere in the world PROVIDED… It has a working JVM.exe © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 24
  • 25. Java Source :: JVM –6b Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) When I say: >> java MyProg.class © Katrin Becker All rights reserved. The target machine loads, and then starts to run the Java Virtual Machine…. Java Virtual Machine Jan 18, 2014 25
  • 26. Java Source :: JVM -7 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) Machine-dependent Machine-dependent Linker/Loader Linker/Loader © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 26
  • 27. Java Source :: JVM -8 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) Machine-dependent Machine-dependent Linker/Loader Linker/Loader The JVM expects a file containing ByteCode as input © Katrin Becker All rights reserved. ‘Java’ Program ‘Java’ Program Running bytecode Running bytecode as input as input Java Virtual Machine Jan 18, 2014 27
  • 28. Java Source :: JVM -9 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code MyProg.class MyProg.class Program Program Running Running © Katrin Becker All rights reserved. The output JVM.exe JVM.exe from the JVM (executable version of (executable version of is the output JVM) JVM) that your program Machine-dependent Machine-dependent produces Linker/Loader Linker/Loader (unless of course the ‘Java’ Program ‘Java’ Program JVM detects a Running bytecode Running bytecode problem) as input as input Java Virtual Machine Jan 18, 2014 28
  • 29. Java Source :: JVM -10 Java Source Program: Java Source Program: MyProg.java MyProg.java JVM source written in C JVM source written in C Java ‘Compiler’ Java ‘Compiler’ C compiler compiles ‘JVM.c’ C compiler compiles ‘JVM.c’ Byte Byte Code Code JVM.exe JVM.exe (executable version of (executable version of JVM) JVM) Machine-dependent Machine-dependent Linker/Loader Linker/Loader MyProg.class MyProg.class Program Program Running Running © Katrin Becker All rights reserved. ‘Java’ Program ‘Java’ Program Running bytecode Running bytecode as input as input Java Virtual Machine MyProg MyProg output output Jan 18, 2014 29
  • 30. The end. © Katrin Becker All rights reserved. Java Virtual Machine Jan 18, 2014 30