Wednesday, April 6, 2016

All about JVM, JDK & JRE

Important :Java is Platform independent because JVM is platform dependent.

Explanation:

Java is “write once, run everywhere” language that means source code is same for all operating system.
Java Compiler translates source code into bytecode which is again same for all Operating system.
When it comes to executing code/instructions, JVM comes into play and depending on which OS our code is running, corresponding JVM will translate bytecode into machine language. Thats why different JVM comes with different OS when you download JDK/JRE from oracle site.

JVM translates bytecode into machine language
Every Java program is compiled into an intermediate language called Java bytecode. The JVM is used to both translate the bytecode into the machine language for a particular computer, and actually execute the corresponding machine-language instructions as well. The JVM and bytecode combined give Java its status as a "portable" language.
Machine language is OS dependent
Given the previous information, it should be easier to deduce an answer to the question. Since the JVM must translate the bytecode into machine language, and since the machine language depends on the operating system being used, it is clear that the JVM is platform (operating system) dependent. This fact can be verified by trying to download the JVM – you will be given a list of JVM’s corresponding to different operating systems, and you will obviously pick whichever JVM is targeted for the operating system that you are running.




Java Runtime Environment (JRE)
The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language. In addition, two key deployment technologies are part of the JRE: Java Plug-in, which enables applets to run in popular browsers; and Java Web Start, which deploys standalone applications over a network. It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for enterprise software development and deployment. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.


Java Development Kit (JDK)
The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.


No comments:

Post a Comment