• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How JIT (Just In Time Compiler) Works

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

We all know that there are two steps of running a java program

[1] convert your .java file to bytecode using javac [called compilation] so you get .class file
[2] run your .class file using java [called interpretation] so you get your output.

I know that .java file is compiled only once using javac & we get .class file i.e bytecode i agree

Now when we want to run the file JRE which has java will run the file and give us the output.

now earlier days in java (may be in jdk1.1 or so) JRE used to interpret the byte code line by line and execute
which had one problem of performance compared to compiled languages like c & c++

so to solve that problem and improve performance now a days JRE includes apart from interpreter also one compiler called JIT(also called HotSpot Compiler) which compiles the byte code(instead of interpreting to native platform) hence improving performance.

first of all is my above understanding correct so far about JIT??

then i have a question?
this directly means that now a days a JRE is capable of both interpreting as well as compiling the byte code.
so question is how it will decide compile or interpret ?

Please s Note when i say compiling the byte code i do know we actually compile .java file ony once,i am not saying compiling .class file with javac again [its not possible] i am saying it in context of running the .class file.

i hope i have made my self clear!!

Please let me know if so far things are correct .

Thanks in advance
Posts: 3742
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a good place to start.

That page was linked to from here which should give you all the information any sane person would ever want about the Java HotSpot Virtual Machine.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic