Is it true that JIT compilers produce native machine code rather than byte code? I read in a book that since JIT compilers produce native machine code the program runs faster. If it produce native machine code then how can it be platform independent?
Originally posted by Sanyev Babu: Is it true that JIT compilers produce native machine code rather than byte code? I read in a book that since JIT compilers produce native machine code the program runs faster. If it produce native machine code then how can it be platform independent?
I was just reading about this in "Head First Java".
Your java code will run on any JVM. However, each JVM is not platform-independent. Each JVM is written for a particular operating system and uses native code to translate your crossplatform bytecode into something the underlying system platform understands."
posted 14 years ago
I was asking if the output of a JIT compiler is a native machine code then how can the program be platform independent. if you are compiling a java source file the compiler generates a class file which will be used by the JVM at runtime. but if you are using a JIT compiler then what is the output? is it a class file in byte code or an executable in machine code or does the JIT compiler also performs the functions of the JVM. I don't have any idea about JIT compilers. any explanations could be helpful.
My understanding is that the compiler output is always in standard java byte codes able to be interpreted by any jre. The jre will assemble the byte code when it runs it for the first time. I do notice that running a button for the first time is slower than the second and further times.
The nice thing about Standards is that there are so many to choose from!