Java Compilation and Interpretation Process

Above figure shows compilation & Interpretation process

Following steps explains how it works:-

  •  We create  a program using program editor(eg. Notepad) and save it as filename.java file in specified directory.
  •  Then we compile it using javac command(eg. javac filename.java), A java compiler then convert .java file into .class file which is called as bytecode and this bytecode is platform independent can run on different platforms eg.Windows, Linux,MAC etc.
  • If any bugs found during compilation that should be fixed first then compiled again, If there is not any bugs found  then bytecode is created and handed over to JVM(java virtual machine) for interpretation.
  • JVM interpret class file by running java space class name command(eg. java filename)  as given in figure.
  • JVM has three components to interpret program first: Bytecode verifier which verifies bytecode, second: Class loader which loads required classes from java class library, third one is a JIT(just in time) compiler which compiles class file and convert it into machine readable format and then hand over to operating system.
  • If there any bugs(mostly logical) found during interpretation(by JVM) then one have to edit program to fix bugs and compile it again.If not any more bugs then final output will be displayed on screen.           


Note: It's not necessary to have same class name and file name. Thing is that file name is required during compilation and class name is required during interpretation but it would be great to use same name for class and file(file name is a name by which we store program).Also compilation process actually figure out any syntactical error while interpretation checks logical error.

5 comments:

Unknown said...

Awesum answer n very easily explained thanx 4 the post

Mridula said...

The blog describes the compilation process very well. The byte code produced during the process accounts for platform independence of the language. JVM converts the application into byte code.

Thanks for posting. Keep posting.java training
java online course

Anonymous said...

goyard bags
hermes bag outlet
golden goose outlet
bape hoodie
golden goose sale
yeezy 350
goyard tote bag
goyard bag
off white shoes
supreme clothing

Piya said...


Java, a true marvel of modern programming languages! Its versatility and robustness have enabled developers to craft remarkable applications that run seamlessly across different platforms. With its object-oriented nature and extensive libraries, Java empowers developers to create elegant and efficient code. Whether it's building complex enterprise systems or sleek mobile applications, Java's reliability shines through, making it a top choice for many developers worldwide. Its constant evolution and community support ensure that Java remains at the forefront of technology, paving the way for innovation and groundbreaking solutions. Hats off to Java for being a driving force behind countless technological advancements besides this if you want to know more about that type related content you can visit here Master Python: From Beginner to Expert in Few Weeks

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|