Java, J2EE & SOA Certification Training
- 33k Enrolled Learners
- Live Class
Java programming language has been a giant in the IT industry for a very long time. It has some top-notch concepts that make it better than the rest of the programming language. One such concept is the Java virtual machine, in this article, we will learn about the various aspects of Java virtual machine in detail. Following are the topics discussed in this blog:
Java virtual machine is a platform-independent abstract machine that provides a runtime environment in which the Java byte code is executed.
It is a part of Java runtime environment that converts the Java bytecode into machine-readable language. The main method that we have in a Java program is actually called by the Java virtual machine.
We need the Java virtual machine for the tasks that it performs which are extremely necessary for any development involving Java. Following are a few tasks that Java virtual machine does.
With all these operations, the Java virtual machine is an integral part of Java development. Let’s try to understand how it works with the help of the Java virtual machine architecture.
Java virtual machine architecture is pretty simple, it has a memory area, a class loader and an execution engine among other components. let us discuss each of them in detail.
It is a subsystem that is used to load class files. Whenever we run a program in java, it is first loaded by the ClassLoader. the major function includes initialization, linking and loading. The following are the built-in classloaders in Java.
Bootstrap ClassLoader – It is the super class of Extension ClassLoader which loads the rt.jar file.
Extension ClassLoader – It loads the jar files located in the directory.
System/Application ClassLoader – It loads the classfiles from the classpath.
Loading Operation – First the classLoader loads the .class files and generates the corresponding data in the binary format which is saved in the method area.
Linking Operation – After loading it prepares, verifies and makes resolution. JVM allocates the memory for class variables and initializes the memory to default values. It ensures the correctness of the .class file and when the verification fails, we get the runtime exception error.
Initialization – All static variables are assigned with their values defined in the code block in this phase.
Method Area – It stores the structures for each class like the code, field data, runtime constant pool, method data, etc.
Heap – Objects are allocated at the runtime in the heap.
JVM Language Stacks – It stores local variables and results. It plays an important role in invoking and returning results. Whenever a method is invoked a frame is created and is destroyed as soon as the invocation ends or completes.
PC Registers – It has the address or location of the JVMinstruction that is being executed.
Native Method Stacks – All the native methods used in the applications are present in the native method stacks.
Execution Engine – An execution engine contains a virtual processor, an interpreter and a JIT compiler.
Now that we have understood the architecture of the JVM, let’s take a look at the execution process and compilation of code.
The following steps take place while the execution and compilation of a Java code.
Now that we know, how the execution works, let’s take a look at the difference between JDK, JRE, and JVM.
Following are a few important differences between JDK, JVM, and JRE.
This brings us to the end of this article where we have learned about the Java virtual machine in detail. I hope you are clear with all that has been shared with you in this tutorial.
If you found this article on “Java Virtual Machine” relevant, check out the Edureka Java Certification Training, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.
We are here to help you with every step on your journey and come up with a curriculum that is designed for students and professionals who want to be a Java Developer. The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts along with various Java frameworks like Hibernate & Spring.
If you come across any questions, feel free to ask all your questions in the comments section of “Java Virtual Machine” and our team will be glad to answer.