Java Virtual Machine,Compiler and Interpretor

JVM performs following operation:
  • Loads code
  • Verifies code
  • Executes code
  • Provides run time environment
  • Memory Management and Garbage Collection.

Process of Java File Execution :- Compiler converts Source code into Byte Code which is further converted to Machine Readable Code by Interpreter which is given to Run time Environment to Execute.

Compile Command:- javac student.java

  • 'c' in javac stands for Compile. No Semicolon

Execute command:- java student (class name)

Compiler checks Syntax and semantic Error

  • Syntax means Semicolon is missing etc. and Semantic error means grammatical mistake like System.out.println() written as Sys.out.println().
An interpreter is a program that reads byte code and translates the source program instruction by instruction into Machine Code. For example, the Java interpreter java translate a .class file into code(Machine Code) that can be executed natively on the underlying machine. 

The interpreter (the JVM) operates on an intermediate form known as byte code rather than on the raw source files. This byte code is generated at compile time by the Java compiler.

References:- Java Point
                      introcs

Comments

Popular Posts