Java Virtual Machine (JVM)

Java Virtual Machine (JVM)
This is generally referred as JVM. Before, we discuss about JVM lets see the phases of program execution. Phases are as follows: we write the program, then we compile the program and at last we run the program.
1) Writing of the program is of course done by java programmer like you and me.
2) Compilation of program is done by javac compiler, javac is the primary java compiler included in java development kit (JDK). It takes java program as input and generates java bytecode as output.
3) In third phase, JVM executes the bytecode generated by compiler. This is called program run phase.

  • JVM stands for Java Virtual Machine.
  • JVM is the engine that drives the java code.
  • Mostly in other Programming Languages, compiler produce code for a particular system but Java compiler produce Bytecode for a Java Virtual Machine.
  • 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.

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.

platform independent

Java is called platform independent because of Java Virtual Machine. As different computers with the different operating system have their own 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).
  • A program of JVM is written into “C Programming Language” and JVM is Operating System dependent.
  • JVM is responsible to allocate the necessary memory needed by the Java program.
  • JVM is responsible to deallocate memory space.
error: Content is protected !!