Core Java Tutorial

Main  
 

Difference between JDK, JRE and JVM

As a java developer, there is a importance of knowing about JRE,JVM and JDK.These are one of the best Interview Question to ask about what is the difference between those three.If you understand JRE vs JVM vs JDK, it is easy to visualize things in logical manner as a developer.JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.

Java Virtual Machine(JVM)

It is virtual because it provides a interface that does't depend's up on the underlying operating system and hardware, which is makes java as a Platform Independene( Write once Run anywhere).JVM works with byte code only(once if you compile your ".class" file you will get the byte code file and this(jvm) is responsible to convert byte code to machine understandable language.JVM also provides Java core functionality like garbage collection, array bounds checking, security etc...

Java Runtime Enviornment(JRE)

JRE contais the information which is required to run the java code.It usually implents JVM and other library files but does't contain any tools.if you want to execute any java code you just had to have only JRE , you don't need to install JDK

Java Development Kit(JDK)

JDK is superset of JRE and also it contains some tools like debugging.if you want to compile your java code you must have JDK in your OS and also path is correct

Why java is Platform Independent?

once if you got the .class file in one OS(Ex: windows) , you can execute the same file in other OS(Ex: Linux) , i.e you can write your code once and run anywhere which makes java as a Platform Independence

Main