Java
Java
Karunya N
Assistant Professor of CS
Sri Ramakrishna College of Arts & Science
JAVA VIRTUAL MACHINE
• The Java Virtual Machine is called JVM, is an abstract computing machine or virtual machine
interface that drives the java code.
What is a JVM?
• Mostly in other Programming Languages, compiler produce code for a particular system but
Java compiler produce Bytecode for a Java Virtual Machine.
• When we compile a Java program, then bytecode is generated. Bytecode is the source code that
can be used to run on any platform.
JAVA VIRTUAL MACHINE (Cont.,)
• Bytecode is an intermediary language between Java source and the host system.
• It is the medium which compiles Java code to bytecode which gets interpreted on a
different machine and hence it makes it Platform/Operating system independent.
• Reading Bytecode
• Verifying Bytecode
• JVM generates a .class(Bytecode) file, and that file can be run in any OS, but JVM should
have in OS because JVM is platform dependent
JAVA VIRTUAL MACHINE (Cont.,)
Platform Independent
• Java is called platform independent because of Java Virtual Machine.
• As different computers with the different operating system have their JVM, when we
submit a .class file to any operating system, JVM interprets the bytecode into machine
level language.
• JVM is the main component of Java architecture, and it is the part of the JRE (Java
Runtime Environment)
• JVM is Operating System dependent.
• JVM is responsible for allocating the necessary memory needed by the Java program.
• JVM is responsible for deallocating memory space.