Java Tutorials :Difference between JDK, JRE, and JVM and References
10. Difference between JDK, JRE, and JVM
JVM(Java Virtual Machine): JVM is an abstract machine. It is called a virtual machine because it doesn't physically exist. It is a specification that provides a runtime environment in which Java bytecode can be executed. It can also run those programs which are written in other languages and compiled to Java bytecode.
JVMs are available for many hardware and software platforms. JVM, JRE, and JDK are platform dependent because the configuration of each OS is different from each other. However, Java is platform independent. There are three notions of the JVM: specification, implementation, and instance.
The JVM performs the following main tasks:
- Loads code
- Verifies code
- Executes code
- Provides runtime environment
Important Points:
- It stands for Java Virtual Machine. JVM Is A "Platform Dependent".
- Also, it executes the Bytecode generated by the Java Compiler.
- Thus, it provides the Run-Time Environment for the applications to Execute/Run.
- JVM takes care of the Memory Area, Register Set, also provides a Garbage Collection Heap.
JRE(Java Runtime Environment): JRE is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. It is the implementation of JVM. It physically exists. It contains a set of libraries + other files that JVM uses at runtime.
The implementation of JVM is also actively released by other companies besides Sun Micro Systems.
Important Points:
- JRE stands for Java Runtime Environment.
- It also gives an environment to run the Java Program.
- Thus, it consists of JVM And Java Class Libraries.
- JRE however provides a package of tools for running Java Codes.
JDK(Java Development Kit): JDK is a software development environment which is used to develop Java applications and applets. It physically exists. It contains JRE + development tools.
Important Points:
- JDK Stands for Java Development Kit.
- Though it Consists of the necessary tools to create java programs.
- Therefore, it Includes JRE, Compilers, Java Debugger, Javadoc.
- Also Require To Create, Compile, And Run The Java Source Code.
- In simple terms, it is a package of tools for developing Java-Based software.
- It requires a JRE because running Java programs is part of developing the Java codes and applications.
ByteCode
Important Points:
- Javac Compiles The Java Code and generates Bytecode which is saved In a .Class file.
- Hence, the generated .Class file can run on any system with the help of JVM.