Mohammad Alorfali profile photo
Mohammad Alorfali
Senior JAVA Engineer In Dubai | Mohammad Alorfali
Articles / Is Java Compiled or Interpreted? JVM + JIT Explained

Is Java Compiled or Interpreted? JVM + JIT Explained

By Mohammad Alorfali ·

Java is both compiled and interpreted: javac compiles to bytecode, the JVM runs it, and the JIT compiles hot code to native machine instructions for performance.

Diagram of the Java execution pipeline: source code compiled by javac to .class bytecode, then executed by the JVM interpreter and optimized by the JIT compiler into machine code.
Java runtime pipeline: bytecode on the JVM, with JIT compilation for hot paths.

Quick insight

People often say “Java is a compiled language.” The more accurate answer is that Java is both compiled and interpreted.

How Java runs: compile, interpret, then JIT

  1. 1.Compile: javac compiles source code into bytecode (.class files). Bytecode is portable and platform-independent.
  2. 2.Run: the JVM loads the bytecode and interprets it so your app starts quickly.
  3. 3.Speed up: the JVM detects hot code and the JIT compiler compiles it into native machine code, applying optimizations.
  4. 4.Result: fast startup and high performance under steady load.

Conclusion

This is why Java is often summarized as “compile once, run anywhere.” You compile to bytecode once, and the JVM + JIT handle execution and optimization on each platform.

Written by Mohammad Alorfali, Senior Java Engineer in Dubai.