From wiki: In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the runtime performance of a computer program.
So I guess JVM has another compiler, not javac, that only compiles bytecode to machine code at runtime, while javac compiles sources to bytecode,is that right?
That is precisely correct.
javaccompiles.javasource code to.classbytecode for JVM (Java Virtual Machine)See also
Even more compilers can get involved!
Note that other languages other than Java can also join in on the fun, by having their own compilers that compile to JVM bytecode, and then use whatever JVM runtime to run on. On HotSpot, this too mean that they’ll get JIT-compiled.
See also