JVM JDK JRE are the most important tools in java programming language.
In this tutorial we will see JVM , JDK, and JRE in java.
JDK in java
The JDK comes with a collection of tools that are used for developing and running java programs which includes applet viewer, javac, java,javah,javadoc, jdb.
There are different JDK tools in java which are as follows
- Appletviewer : It enables to run java applets without using a java compatible browser.
- Javac : Java compiler, which is used to compile the java spice code into intermediate code called byte code. It compiles the .java file and creates .class file.
- Java : Java interpreter, which is used to interpret the byte code and execute applet and other applications. Javap
- Java disassembler : which is used to convert byte code to program.
- Javah : This is used to produce header files for use with native methods
- Javadoc: It is used to create the HTML format documentation from java source code.
- Jdb : Java debugger, which finds any error in programs.
JVM in java
Java virtual machine(JVM) is a platform where java compiled code are get executed.
Compiler translates the source code into machine code for specific computer but the compiler produces an intermediate code called byte code, for machine that does not exist. This machine is called as JVM and it is exist inside computer memory.
In short JVM is software implementation that executes the programs.
JVM architecture in java
How JVM works?
JVM is an execution environment where actually the program gets executed.
The JVM Finds the main method and executes (interprets) the code. It reads the byte code and executes the code.
The above diagram shows the execution of the program starting from writing code to the executing code on JRE.
The JVM performs following main tasks
- Load code
- Verify the code
- Execute code
- Provide execution environment
Is JVM is compiler or interpreter?
JVM is Interpreter. It interprets the byte code to generate output.
JRE in java
Java runtime environment (JRE) is also called JAVA RTE
JRE is used to executing the java application; it contains JVM and core classes and supporting files.
It physically exists in machine.
JDK, JVM and JRE in java
The below diagram shows the sturcture of JDK, JVM and JRE in java.
JDK(java development kit) is the main tool which contains all the tools required to develop and execute the application in java programming.
JDK =JRE+Development Tools
JRE = JVM+ Liabrary classes
JVM = Execution Environment