The Java Virtual Machine (JVM) is an environment that executes Java programs. Java programs are compiled into an intermediate language called bytecode. When we run a program, JVM is responsible to converting Byte code to the machine specific code. JVM is also platform dependent and provides core Java functions like memory management, garbage collection, security etc. JVM is customizable and we can use java options to customize it, for example allocating minimum and maximum memory to JVM. JVM is called virtual because it provides a interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and operating system is what makes java program write-once run-anywhere. This makes Java software compatible with many different computing platforms.Things one should know about JVM::
- Java bytecode can be written once and then run on multiple platforms. Java bytecode does not need to be ported to a specific hardware environment because it runs in the Java Virtual Machine.
- Java was written with security in mind. The Java Virtual Machine has built-in security features that allow programmers to write highly secure Java programs. It also prevents malicious software from compromising the Operating System (OS) because it keeps Java applications from interacting with Operating System resources.
- Java programs that run on a Java Virtual Machine tend to perform slower than equivalent programs written in C++. The system neutrality of bytecode acts as a disadvantage where performance is concerned. This is because code optimization relies heavily on system-specific features. Since Java bytecode is system-neutral, it cannot be optimized for a specific hardware set.
- A program that performs, as expected, is said to be correct. Since a Java program relies on the Java Virtual Machine to execute it, the JVM must be free of errors for the program to operate correctly. Luckily, the Java Virtual Machine software is produced with very high standards, and therefore it isn’t likely to ship with any errors.