In this article we are going to learn what are JVM, JRE and JDK and also different from each other. Let us have a look at the simple image representing the difference between JDK, JDK and JRE.

 

Java jdk, jvm and jre Explained

in Simple terms to explain above diagram. When user writes a code that will be compiled using the JDK and the output of that compiled Java file/code is a .class file which is in bytecode. If user wanted to execute the bytecode he needs to give the .class file to JVM which is an abstract specification implemented by the JRE.

More details about JDK, JVM and JRE below.

What is JDK?

The JDK means Java Development Kit which is a combination of components that are used to develop the java based applications. It is an implementation of Java SE, Java EE or Java ME. It includes the JRE, set of API classes, Java compiler and additional files that are required to write the applets and applications. Some of the components that are included in JDK are:

  • Java Compiler: It is a javac tool located in /bin folder of the JDK installation directory. This tool will read the class and interface definitions that are written in java programming language and compile them into byte code class file.
  • Java Interpreter: It is used to interpret the .class java file which is compiled by the java compiler and it is accessed using the java command and it starts the java application by starting the java runtime environment, then it will load the specified class and then will call the class main method. The methods declared in this are public and static.
  • Java Disassembler: In this, you use javap command that is a disassembly tool of JDK which disassembles one or more class file. The output will be based on the option chosen; if no option is selected or used then javap will print the package, public and protected field and methods of the classes passed to it.
  • Java Documentation: It helps to maintain the code and it can be done by using javadoc tool which is a part of the JDK.
  • Java Debugger: It is a simple command line debugger for the java classes.
  • Java AppletViewer: It is used to view the applets and for this you use appletviewer command to connect to the documents and display applet that is re referenced by the document in its own document.

What is JVM?

A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program. JVM is an abstract (virtual) computer defined by a specification and it provides specification to the run time environment in which java bytecode can be executed.

In other programming languages the compiler builds the code for the particular machine. Whereas in Java the java compiler builds the code as bytecode for the virtual machine. This virtual machine implemented JRE is responsible to convert the byte code to machine readable code.

What is JRE?

The JRE means Java Runtime Environment which is an implementation of JVM and it executes the Java programs. It includes JVM, core libraries and some other components which are used to run Java applications and applets. To execute the pre compiled Java programs it is necessary to have JRE on the machine. In comparison to JDK, JRE is less in size so, it requires less space on disk. As it is less in size so, it does not include the Java compiler and any other software tools which are required to develop the Java programs. The Oracle Corporation distributes a Java Runtime environment with their Java Virtual Machine called HotSpot.

Download link for JDK and JRE can be found @ http://www.oracle.com/technetwork/java/javase/downloads/index.html

Don’t Miss the Architecture of JVM HERE

Do Let us Know If you are looking for anything specific to learn. We are happy to post the topic.