The Java Virtual Machine serves as an additional layer of abstraction between the Java platform and the underlying machine hardware. Java source code can only run on machines with JVM installed. The answer to the question of why the Java Virtual Machine is needed lies in the history of programming.
Programming History
When the first native programming languages were developed, they were divided into two main categories depending on how these languages interfaced with the underlying hardware.
Compiler: The complete program is written in natural English-like syntax using compilers, then the language compiles (or translates) the entire code into machine code. The compiled code will now run on the hardware.
Interpreter: For interpreters, all high-level code statements are interpreted into machine code while the hardware is running. The hardware will immediately execute the written instructions before considering the next statement.
Java Runtime Environment
The Java program was the first language to combine both of the above methods with a single Java Virtual Machine (JVM). The Java compiler is called the Java Virtual Machine. Every Java file is compiled to bytecode first. Java bytecode can only run in JVM. The JVM will then interpret the bytecode to run the bytecode on the underlying hardware platform. So if the application is running on a Windows machine, the JVM interprets the application for Windows. But if the application runs on an open source platform like Linux, the JVM interprets it for Linux.
How to Program in Java
To start programming in Java, you need to have a Java Version installed on your system. There are 4 major versions of Java:
Java Standard Edition (Java SE)
Java Enterprise Edition (Java EE)
Java micro version (Java ME)
What is Java SE?
Java Standard Edition is the main Java programming platform. This version contains all the libraries and APIs that every programmer needs to develop Java. The Open Java Development Kit (OpenJDK) is the free, open source version of Java SE.
Amazon Corretto is a production-ready, cross-platform, free distribution of OpenJDK. It can be used as a temporary replacement for many Java SE distributions and is supported by Amazon for free in the long term. This distro allows you to run the same environment in the cloud, on-premises, or on a local machine.
Comments
Post a Comment