JVM, JRE, JDK
JAVA BASICS OVERVIEW
-
What is JAVA?
- Platform Independent language
- Supports OOPS
- Portability [WORA]
- Write Once Run Anywhere
-
3 Main Components Of Java
┌───────────┐ │ JDK │ │ ┌─────────┐ │ │ │ JRE │ │ │ │ ┌───────┐ │ │ │ │ │ JVM │ │ │ │ │ └───────┘ │ │ │ └─────────┘ │ └───────────┘
So JVM, JRE & JDK are 3 main components of Java.
⇒ JVM : Java Virtual Machine
-
It's just an abstract machine that doesn't exist physically.
[Java Program] --Compiler--> [Bytecode] --JVM--> [Machine Code] --> [CPU] --> Output
-
So JVM is platform dependent.
-
So we need to install JVM based on the platform i.e macOS, Linux or Windows. Input for JVM is bytecode & output is machine code.
-
Now since bytecode can be run by any JVM, it makes a Java program platform independent.
-
JVM has JIT (Just In Time) compiler which takes bytecode & converts it into machine code.
⇒ JRE : Java Runtime Environment
-
JRE contains JVM & class libraries i.e the libraries which we've used in the code.
┌─────────────────┐ │ JRE │ │ ┌───────────┐ │ │ │ Class │ │ │ │ Libraries │ │ │ └───────────┘ │ │ ┌───────────┐ │ │ │ JVM │ │ │ └───────────┘ │ └─────────────────┘
-
So if we have JRE, we can run any Java Program but we cannot code the program.
⇒ JDK : Java Development Kit
-
It has program language information
-
It has compiler (javac)
-
It has debugger
-
So JDK = JRE + (Program Language + compiler + debugger + other dev. components)
-
So JVM, JRE & JDK all three are platform dependent but the compiled bytecode is platform independent.
-
Java Editions:
- JSE: Java Standard Edition
- JEE: Java Enterprise Edition (Jakarta EE)
- JME: Java Micro / Mobile Edition
-
JSE is the core Java.
-
JEE = JSE + Servlets + JSP + Transaction API + Persistence API
-
JME = API for mobile applications
No Comments