Quote from the book "Java. A new generation of development":

"In technical terms, from the point of view of compilation theory, bytecode is really a kind of intermediate language (intermediate language), not real machine code. This means that the process of converting Java source code into bytecode is not a compilation in the sense how it is understood in C and C ++ languages. In turn, javac cannot be called the same compiler as gcc. In essence, it is a generator of class files for processing Java source code. A true compiler in the Java ecosystem is a dynamic compiler (JIT) " .

Do I understand correctly that while JIT is a dynamic compiler, javac is a static compiler?

  • java has no static compilation. - vp_arth

1 answer 1

Javac is not a static compiler. Because it generates byte code, which already in the process of program execution will be dynamically compiled into machine code, or interpreted .

But in java 9 it will be possible to generate machine code before running the program.

  • But this compilation of Ahead-Of-Time, which will appear in java 9, will be a full-fledged static compilation, right? - Ksenia
  • @Ksenia that way. the native code will be generated immediately - Artem Konovalov