JVM (Java Virtual Machine): After Java programs are compiled, they are transformed into a language that the computer can understand. This is called bytecode. Bytecode allows Java programs to run independently of platforms. Bytecode is created once and works on every operating system. This is known as “write once run everywhere,” and it is facilitated by the JVM (Java Virtual Machine). Let me explain the logic of how Java programs run in more detail. Java programs consist of objects and classes. The files containing the written classes have the extension .java. These .java files are compiled with the help of a compiler and transformed into machine code called bytecode. Now the extension of these files has become .class. This process is only done once. These .class bytecode files run on every operating system with the help of the JVM. The JVM interprets these bytecode files step by step. To run Java programs on other operating systems, there must be a JVM installed on that machine. It interprets the ready bytecode on that machine, making it compatible with the operating system. Nowadays, JVMs have been developed for almost every platform.

JRE (Java Runtime Environment): To run programs written in Java, JRE must be installed. When we develop an application, it is necessary to have it installed on our computer to run it. We can liken this to the need for the .Net framework when writing code in the C# language.

Java codes, after being compiled, need to be transformed into bytecode because they don’t run directly on a machine. JRE performs this transformation. The interpreted bytecode is then executed by the JVM. Inside the JRE, there are Java libraries and the JVM virtual machine. When we install JRE, we automatically install JVM.

When explaining the concept of JVM, we mentioned that JVM must be installed for Java codes to run on our computer. Since JVM is included in JRE, installing JRE is sufficient to run Java codes.

JDK (Java Development Kit): After understanding the intricacies and performance of Java, one might want to develop a Java application. For this purpose, we need JDK. JDK provides all the tools needed to develop Java applications. It includes Java JDKs, JVM, and JRE. If you want to develop an application, installing only JDK is sufficient because JDK includes JRE, and JRE includes JVM.

Summary = JDK is for application development, JRE is for running applications, and JVM provides a platform-independent environment, enabling compiled code to run on different platforms.

Leave a Reply

Your email address will not be published. Required fields are marked *