JVM
- It is a virtual machine that can execute Java bytecode. It is the code execution component of the Java software platform.
- The Java Virtual machine (JVM) is the virtual machine that run the Java bytecodes. The JVM doesn't understand Java typo, that's why you compile your
*.java
files to obtain*.class
files that contain the bytecodes understandable by the JVM. It's also the entity that allows Java to be a "portable language" (write once, run anywhere). Indeed there are specific implementations of the JVM for different systems (Windows, Linux, MacOS,), the aim is that with the same bytecodes they all give the same results. - As we all aware when we compile a Java file, output is not an ‘exe’ but it’s a ‘.class’ file. ‘.class’ file consists of Java byte codes which are understandable by JVM. Java Virtual Machine interprets the byte code into the machine code depending upon the underlying operating system and hardware combination. It is responsible for all the things like garbage collection, array bounds checking, etc… JVM is platform dependent.
- The JVM is called “virtual” because it provides a machine interface that does not depend on the underlying operating system and machine hardware architecture. This independence from hardware and operating system is a cornerstone of the write-once run-anywhere value of Java programs.
- There are different JVM implementations are there. These may differ in things like performance, reliability, speed, etc. These implementations will differ in those areas where Java specification doesn’t mention how to implement the features, like how the garbage collection process works is JVM dependent, Java spec doesn’t define any specific way to do this.
- this actually means the byte code interpreter .It is platform dependent. For eg: in Windows platform the 'java.exe' or 'javaw.exe' precess is the jvm process.