What is JVM?
JVM is an acronym for Java Virtual Machine. A Java Virtual Machine is an abstract machine that enables your computer to run a Java program. Without JVM, no Java program or application can be executed. It is the heart of the Java programming language. When we run a Java program, the Java compiler first compiles your Java code as tiny pieces of code known as bytecode. Then, the JVM translates bytecode into machine code (set of instructions that a computer's CPU executes directly).
It is important to know that the JVM is the reason that Java is a platform-independent language. This is because when you write Java code or program, it's ultimately written for JVM and not the physical computer or device you're using. However, it is equally important to know that JVM also depends on the Operating System (OS) of your device for core java functions like memory management, garbage collection, security, etc.
The JVM performs the following main tasks:
Provides runtime environment
What is JRE?
JRE is an acronym for Java Runtime Environment. A Java Runtime Environment is a software package that provides Java class libraries, along with Java Virtual Machine (JVM), and other components to run applications written in Java programming. It does not contain any development tools such as compiler, debugger, etc. If you need to run Java programs, but not develop them, Java Runtime Environment is what you need.
What is JDK?
JDK is an acronym for Java Development Kit. A Java Development Kit is a software development kit used to develop applications in Java. When you download JDK, JRE is also downloaded, and don't need to download it separately. In addition to JRE, JDK also contains several development tools such as compilers, JavaDoc, Java Debugger, etc to develop Java applications.
What is Javac?
Javac stands for Java compiler. It is the tool that can transform Java programming code to the Java bytecode.
What is Jar?
JAR is an Abbreviation for Java Archive. It is a ZIP file, which contains compiled Java code(s), and in some cases also contains the source codes of Java programs and applications.
As it is a ZIP file, file elements may be compressed, shortening download times. A JAR file allows Java runtimes to efficiently deploy an entire application, including its classes and their associated resources, in a single request.
What are Java libraries?
A Java library is a set of Java classes that are generally organized and packaged in some coherent manner to promote reuse.
The image below may help you understand the difference between JDK, JRE, JVM, and other Java Components.